Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run prettier separately #183

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
files/
tests/fixtures/

*.md
2 changes: 1 addition & 1 deletion files/__addonLocation__/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:prettier/recommended',
'prettier',
],
env: {
browser: true,
Expand Down
3 changes: 2 additions & 1 deletion files/__addonLocation__/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"lint:js": "eslint . --cache",
"lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
"lint:js:fix": "eslint . --fix",<% if (typescript) { %>
"lint:prettier": "prettier --check .",
"lint:prettier:fix": "prettier --write .",
"lint:types": "glint",
"start": "concurrently 'npm:start:*'",
"start:js": "rollup --config --watch --no-watch.clearScreen",
Expand Down Expand Up @@ -75,7 +77,6 @@
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-ember": "^11.6.0",
"eslint-plugin-n": "^16.0.0",
"eslint-plugin-prettier": "^4.0.0",
"prettier": "^2.5.1",
"prettier-plugin-ember-template-tag": "^1.0.0",
"rollup": "^3.21.8"<% if (!isExistingMonorepo) { %>,
Expand Down
18 changes: 9 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = {
if (!options.addonOnly) {
if (fs.existsSync(path.join('..', 'package.json'))) {
options.ui.writeInfoLine(
"Existing monorepo detected! The blueprint will only create the addon and test-app folders, and omit any other files in the repo's root folder."
"Existing monorepo detected! The blueprint will only create the addon and test-app folders, and omit any other files in the repo's root folder.",
);

this.isExistingMonorepo = true;
Expand Down Expand Up @@ -79,7 +79,7 @@ module.exports = {
}

await fs.writeFile(packageJson, JSON.stringify(json, null, 2));
})()
})(),
);

if (options.pnpm) {
Expand All @@ -97,7 +97,7 @@ module.exports = {
await this.moveFilesForExistingMonorepo(options);

this.ui.writeWarnLine(
`Make sure your workspaces are configured correctly to cover the newly created ${addonInfo.location} and ${testAppInfo.location} packages!`
`Make sure your workspaces are configured correctly to cover the newly created ${addonInfo.location} and ${testAppInfo.location} packages!`,
);
}

Expand All @@ -118,7 +118,7 @@ module.exports = {
assert(
!options.addonOnly,
`When in --addon-only mode, we don't need to move files within an existing monorepo. ` +
`If you see this error, please open an issue at: https://github.com/embroider-build/addon-blueprint/issues`
`If you see this error, please open an issue at: https://github.com/embroider-build/addon-blueprint/issues`,
);

let addonInfo = addonInfoFromOptions(options);
Expand Down Expand Up @@ -151,7 +151,7 @@ module.exports = {
assert(
!options.addonOnly,
`When in --addon-only mode, we don't create a test-app. ` +
`If you see this error, please open an issue at: https://github.com/embroider-build/addon-blueprint/issues`
`If you see this error, please open an issue at: https://github.com/embroider-build/addon-blueprint/issues`,
);

const appBlueprint = this.lookupBlueprint('app');
Expand Down Expand Up @@ -190,11 +190,11 @@ module.exports = {

if (lt(hasVersion, needsVersion)) {
this.ui.writeWarnLine(
`Your version ${hasVersion} of Ember CLI does not support the --typescript flag yet. Please run \`ember install ember-cli-typescript\` in the ${testAppInfo.location} folder manually!`
`Your version ${hasVersion} of Ember CLI does not support the --typescript flag yet. Please run \`ember install ember-cli-typescript\` in the ${testAppInfo.location} folder manually!`,
);
} else if (lt(hasVersion, recommendedVersion)) {
this.ui.writeWarnLine(
`We recommend using Ember CLI >= ${recommendedVersion} for the best blueprint support when using TypeScript!`
`We recommend using Ember CLI >= ${recommendedVersion} for the best blueprint support when using TypeScript!`,
);
}
}
Expand Down Expand Up @@ -298,7 +298,7 @@ module.exports = {
let ignoredFiles = ['__addonLocation__/tsconfig.json'];

files = files.filter(
(filename) => !filename.match(/.*\.ts$/) && !ignoredFiles.includes(filename)
(filename) => !filename.match(/.*\.ts$/) && !ignoredFiles.includes(filename),
);
}

Expand All @@ -316,7 +316,7 @@ module.exports = {

if (this.project.isEmberCLIProject() && !this.project.isEmberCLIAddon()) {
throw new SilentError(
'Generating an addon in an existing ember-cli project is not supported.'
'Generating an addon in an existing ember-cli project is not supported.',
);
}

Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
"license": "MIT",
"author": "simonihmig <[email protected]>",
"scripts": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have not previously been running prettier on this repo, so we have more changes than normal

"lint": "eslint . --cache",
"lint:fix": "eslint . --fix",
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"lint:prettier": "prettier -c .",
"lint:prettier:fix": "prettier -w .",
"test": "pnpm --filter 'blueprint-tests' test"
},
"dependencies": {
Expand All @@ -29,6 +33,7 @@
"@release-it-plugins/lerna-changelog": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"concurrently": "^8.2.0",
"eslint": "^8.19.0",
"prettier": "^3.0.2",
"release-it": "^15.5.0",
Expand Down
Loading