-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ember-cli 6.1, eslint 9, eslint flat config, RFC#1055 (#320)
* ember-cli < 6.1 is too old * Switch to ESLint 9 * fix * afix * fix * ope * Cleanup, update prettier config * ope * Fix lints * Lints * lints * Fix assertions * Use TypeScript 5.6 * Upgrade typescript-eslint * Set project: true * Override ember-cli's tsconfig.json see: ember-cli/ember-cli#10611 and ember-cli/ember-cli#10613 and ember-cli/ember-cli#10612 * Re-lock
- Loading branch information
1 parent
7858389
commit 8144fec
Showing
18 changed files
with
417 additions
and
551 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,5 @@ node_modules/ | |
|
||
# Test artifacts | ||
coverage/ | ||
tests/my-addon/ | ||
tests/test-app/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/** | ||
* Debugging: | ||
* https://eslint.org/docs/latest/use/configure/debug | ||
* ---------------------------------------------------- | ||
* | ||
* Print a file's calculated configuration | ||
* | ||
* npx eslint --print-config path/to/file.js | ||
* | ||
* Inspecting the config | ||
* | ||
* npx eslint --inspect-config | ||
* | ||
*/ | ||
import babelParser from '@babel/eslint-parser'; | ||
import js from '@eslint/js'; | ||
import prettier from 'eslint-config-prettier'; | ||
import ember from 'eslint-plugin-ember/recommended'; | ||
import importPlugin from 'eslint-plugin-import'; | ||
import n from 'eslint-plugin-n'; | ||
import globals from 'globals'; | ||
|
||
const esmParserOptions = { | ||
ecmaFeatures: { modules: true }, | ||
ecmaVersion: 'latest', | ||
}; | ||
|
||
export default [ | ||
js.configs.recommended, | ||
prettier, | ||
ember.configs.base, | ||
ember.configs.gjs, | ||
/** | ||
* Ignores must be in their own object | ||
* https://eslint.org/docs/latest/use/configure/ignore | ||
*/ | ||
{ | ||
ignores: ['dist/', 'declarations/', 'node_modules/', 'coverage/', '!**/.*'], | ||
}, | ||
/** | ||
* https://eslint.org/docs/latest/use/configure/configuration-files#configuring-linter-options | ||
*/ | ||
{ | ||
linterOptions: { | ||
reportUnusedDisableDirectives: 'error', | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.js'], | ||
languageOptions: { | ||
parser: babelParser, | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.{js,gjs}'], | ||
languageOptions: { | ||
parserOptions: esmParserOptions, | ||
globals: { | ||
...globals.browser, | ||
}, | ||
}, | ||
}, | ||
{ | ||
files: ['src/**/*'], | ||
plugins: { | ||
import: importPlugin, | ||
}, | ||
rules: { | ||
// require relative imports use full extensions | ||
'import/extensions': ['error', 'always', { ignorePackages: true }], | ||
}, | ||
}, | ||
/** | ||
* CJS node files | ||
*/ | ||
{ | ||
files: [ | ||
'**/*.cjs', | ||
'.prettierrc.js', | ||
'.stylelintrc.js', | ||
'.template-lintrc.js', | ||
'addon-main.cjs', | ||
], | ||
plugins: { | ||
n, | ||
}, | ||
|
||
languageOptions: { | ||
sourceType: 'script', | ||
ecmaVersion: 'latest', | ||
globals: { | ||
...globals.node, | ||
}, | ||
}, | ||
}, | ||
/** | ||
* ESM node files | ||
*/ | ||
{ | ||
files: ['**/*.mjs'], | ||
plugins: { | ||
n, | ||
}, | ||
|
||
languageOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 'latest', | ||
parserOptions: esmParserOptions, | ||
globals: { | ||
...globals.node, | ||
}, | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/** | ||
* Debugging: | ||
* https://eslint.org/docs/latest/use/configure/debug | ||
* ---------------------------------------------------- | ||
* | ||
* Print a file's calculated configuration | ||
* | ||
* npx eslint --print-config path/to/file.js | ||
* | ||
* Inspecting the config | ||
* | ||
* npx eslint --inspect-config | ||
* | ||
*/ | ||
import babelParser from '@babel/eslint-parser'; | ||
import js from '@eslint/js'; | ||
import prettier from 'eslint-config-prettier'; | ||
import ember from 'eslint-plugin-ember/recommended'; | ||
import importPlugin from 'eslint-plugin-import'; | ||
import n from 'eslint-plugin-n'; | ||
import globals from 'globals'; | ||
import ts from 'typescript-eslint'; | ||
|
||
const parserOptions = { | ||
esm: { | ||
js: { | ||
ecmaFeatures: { modules: true }, | ||
ecmaVersion: 'latest', | ||
}, | ||
ts: { | ||
projectService: true, | ||
project: true, | ||
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
}; | ||
|
||
export default ts.config( | ||
js.configs.recommended, | ||
ember.configs.base, | ||
ember.configs.gjs, | ||
ember.configs.gts, | ||
prettier, | ||
/** | ||
* Ignores must be in their own object | ||
* https://eslint.org/docs/latest/use/configure/ignore | ||
*/ | ||
{ | ||
ignores: ['dist/', 'declarations/', 'node_modules/', 'coverage/', '!**/.*'], | ||
}, | ||
/** | ||
* https://eslint.org/docs/latest/use/configure/configuration-files#configuring-linter-options | ||
*/ | ||
{ | ||
linterOptions: { | ||
reportUnusedDisableDirectives: 'error', | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.js'], | ||
languageOptions: { | ||
parser: babelParser, | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.{js,gjs}'], | ||
languageOptions: { | ||
parserOptions: parserOptions.esm.js, | ||
globals: { | ||
...globals.browser, | ||
}, | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.{ts,gts}'], | ||
languageOptions: { | ||
parser: ember.parser, | ||
parserOptions: parserOptions.esm.ts, | ||
}, | ||
extends: [...ts.configs.recommendedTypeChecked, ember.configs.gts], | ||
}, | ||
{ | ||
files: ['src/**/*'], | ||
plugins: { | ||
import: importPlugin, | ||
}, | ||
rules: { | ||
// require relative imports use full extensions | ||
'import/extensions': ['error', 'always', { ignorePackages: true }], | ||
}, | ||
}, | ||
/** | ||
* CJS node files | ||
*/ | ||
{ | ||
files: [ | ||
'**/*.cjs', | ||
'.prettierrc.js', | ||
'.stylelintrc.js', | ||
'.template-lintrc.js', | ||
'addon-main.cjs', | ||
], | ||
plugins: { | ||
n, | ||
}, | ||
|
||
languageOptions: { | ||
sourceType: 'script', | ||
ecmaVersion: 'latest', | ||
globals: { | ||
...globals.node, | ||
}, | ||
}, | ||
}, | ||
/** | ||
* ESM node files | ||
*/ | ||
{ | ||
files: ['**/*.mjs'], | ||
plugins: { | ||
n, | ||
}, | ||
|
||
languageOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 'latest', | ||
parserOptions: parserOptions.esm.js, | ||
globals: { | ||
...globals.node, | ||
}, | ||
}, | ||
}, | ||
); |
Oops, something went wrong.