Skip to content

Commit

Permalink
Merge pull request #1388 from NullVoxPopuli/enable-prettier-in-ci
Browse files Browse the repository at this point in the history
Enable prettier in ci
  • Loading branch information
NullVoxPopuli authored Apr 19, 2023
2 parents 6e54dd1 + 585811b commit a6cd4aa
Show file tree
Hide file tree
Showing 16 changed files with 133 additions and 49 deletions.
60 changes: 60 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# No need to run prettier here
*.md
*.yml
*.html
*.json


# Compiled output
/packages/core/**/*.js
/packages/core/**/*.d.ts
/packages/shared-internals/**/*.js
/packages/shared-internals/**/*.d.ts
/packages/compat/**/*.js
/packages/compat/**/*.d.ts
/packages/macros/**/*.js
/packages/macros/**/*.d.ts
/packages/util/src/**/*.js
/packages/util/src/**/*.d.ts
/packages/webpack/**/*.js
/packages/webpack/**/*.d.ts
/packages/hbs-loader/**/*.js
/packages/hbs-loader/**/*.d.ts
/test-packages/support/**/*.js
/test-packages/**/*.d.ts
/tests/scenarios/**/*.js
/tests/scenarios/**/*.d.ts
/packages/test-setup/**/*.js
/packages/test-setup/**/*.d.ts
/packages/addon-shim/**/*.js
/packages/addon-shim/**/*.d.ts
/packages/addon-dev/**/*.js
/packages/addon-dev/**/*.d.ts
/tests/fixtures/

# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/packages/*/dist/
/packages/*/tmp/
/test-packages/*/dist/
/test-packages/*/tmp/

# dependencies
bower_components/
node_modules/

# misc
coverage/
!.*

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try

#types added
/types/**

13 changes: 10 additions & 3 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
'use strict';

module.exports = {
singleQuote: true,
trailingComma: 'es5',
printWidth: 120,
arrowParens: 'avoid',
overrides: [
{
files: '*{js,ts}',
options: {
trailingComma: 'es5',
arrowParens: 'avoid',
singleQuote: true,
},
},
],
};
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@
"release": "changeset publish",
"clean": "git clean -x -f",
"compile": "tsc",
"lint": "concurrently 'yarn:lint:*'",
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
"lint:eslint": "eslint . --cache",
"lint:eslint:fix": "eslint . --fix",
"lint:prettier": "prettier . -c",
"lint:prettier:fix": "prettier . -w",
"lint:router-types": "cd packages/router && yarn lint:types",
"prepare": "tsc && yarn build-v2-addons",
"build-v2-addons": "concurrently 'yarn:build-v2-addons:*'",
Expand Down
9 changes: 8 additions & 1 deletion packages/util/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
'use strict';

module.exports = {
singleQuote: true,
overrides: [
{
files: '*{js,ts}',
options: {
singleQuote: true,
},
},
],
};
35 changes: 12 additions & 23 deletions test-packages/sample-transforms/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@ module.exports = {
root: true,
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module'
sourceType: 'module',
},
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
],
plugins: ['ember'],
extends: ['eslint:recommended', 'plugin:ember/recommended'],
env: {
browser: true
},
rules: {
browser: true,
},
rules: {},
overrides: [
// node files
{
Expand All @@ -27,26 +21,21 @@ module.exports = {
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'tests/dummy/config/**/*.js'
],
excludedFiles: [
'addon/**',
'addon-test-support/**',
'app/**',
'tests/dummy/app/**'
'tests/dummy/config/**/*.js',
],
excludedFiles: ['addon/**', 'addon-test-support/**', 'app/**', 'tests/dummy/app/**'],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015
ecmaVersion: 2015,
},
env: {
browser: false,
node: true
node: true,
},
plugins: ['node'],
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
// add your custom rules and overrides for node files here
})
}
]
}),
},
],
};
2 changes: 1 addition & 1 deletion test-packages/sample-transforms/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports = {
extends: 'recommended'
extends: 'recommended',
};
4 changes: 2 additions & 2 deletions test-packages/sample-transforms/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports = function(/* environment, appConfig */) {
return { };
module.exports = function (/* environment, appConfig */) {
return {};
};
2 changes: 1 addition & 1 deletion test-packages/sample-transforms/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
module.exports = function (defaults) {
let app = new EmberAddon(defaults, {
// Add options here
});
Expand Down
2 changes: 1 addition & 1 deletion test-packages/sample-transforms/tests/dummy/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import config from './config/environment';
const App = Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver
Resolver,
});

loadInitializers(App, config.modulePrefix);
Expand Down
5 changes: 2 additions & 3 deletions test-packages/sample-transforms/tests/dummy/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import config from './config/environment';

const Router = EmberRouter.extend({
location: config.locationType,
rootURL: config.rootURL
rootURL: config.rootURL,
});

Router.map(function() {
});
Router.map(function () {});

export default Router;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

module.exports = function(environment) {
module.exports = function (environment) {
let ENV = {
modulePrefix: 'dummy',
environment,
Expand All @@ -13,14 +13,14 @@ module.exports = function(environment) {
},
EXTEND_PROTOTYPES: {
// Prevent Ember Data from overriding Date.parse.
Date: false
}
Date: false,
},
},

APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
},
};

if (environment === 'development') {
Expand Down
8 changes: 2 additions & 6 deletions test-packages/sample-transforms/tests/dummy/config/targets.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
'use strict';

const browsers = [
'last 1 Chrome versions',
'last 1 Firefox versions',
'last 1 Safari versions'
];
const browsers = ['last 1 Chrome versions', 'last 1 Firefox versions', 'last 1 Safari versions'];

const isCI = !!process.env.CI;
const isProduction = process.env.EMBER_ENV === 'production';
Expand All @@ -14,5 +10,5 @@ if (isCI || isProduction) {
}

module.exports = {
browsers
browsers,
};
9 changes: 8 additions & 1 deletion tests/addon-template/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
'use strict';

module.exports = {
singleQuote: true,
overrides: [
{
files: '*{js,ts}',
options: {
singleQuote: true,
},
},
],
};
12 changes: 12 additions & 0 deletions tests/app-template/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

module.exports = {
overrides: [
{
files: '*{js,ts}',
options: {
singleQuote: true,
},
},
],
};
6 changes: 5 additions & 1 deletion tests/app-template/config/targets.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict';

const browsers = ['last 1 Chrome versions', 'last 1 Firefox versions', 'last 1 Safari versions'];
const browsers = [
'last 1 Chrome versions',
'last 1 Firefox versions',
'last 1 Safari versions',
];

module.exports = {
browsers,
Expand Down
1 change: 0 additions & 1 deletion tests/ts-app-template/app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{page-title "TsAppTemplate"}}


{{outlet}}

0 comments on commit a6cd4aa

Please sign in to comment.