forked from spartan-ng/spartan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nx): convert to eslint flat config (spartan-ng#265)
* feat(nx): convert to eslint flat config * fix(nx): use .cjs extensions for flat config to work --------- Co-authored-by: Robin Goetz <[email protected]>
- Loading branch information
1 parent
694e0e4
commit fbf92e3
Showing
183 changed files
with
2,580 additions
and
2,119 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"eslint.validate": ["json"] | ||
"eslint.validate": ["json"], | ||
"eslint.experimental.useFlatConfig": true, | ||
"eslint.format.enable": true | ||
} |
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,42 @@ | ||
const { FlatCompat } = require('@eslint/eslintrc'); | ||
const baseConfig = require('../../eslint.config.cjs'); | ||
const js = require('@eslint/js'); | ||
|
||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
}); | ||
|
||
module.exports = [ | ||
...baseConfig, | ||
...compat | ||
.config({ extends: ['plugin:@nx/angular', 'plugin:@angular-eslint/template/process-inline-templates'] }) | ||
.map((config) => ({ | ||
...config, | ||
files: ['**/*.ts'], | ||
rules: { | ||
'@angular-eslint/no-host-metadata-property': 0, | ||
'@angular-eslint/directive-selector': [ | ||
'error', | ||
{ | ||
type: 'attribute', | ||
prefix: 'spartan', | ||
style: 'camelCase', | ||
}, | ||
], | ||
'@angular-eslint/component-selector': [ | ||
'error', | ||
{ | ||
type: 'element', | ||
prefix: 'spartan', | ||
style: 'kebab-case', | ||
}, | ||
], | ||
}, | ||
})), | ||
...compat.config({ extends: ['plugin:@nx/angular-template'] }).map((config) => ({ | ||
...config, | ||
files: ['**/*.html'], | ||
rules: {}, | ||
})), | ||
]; |
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
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,16 @@ | ||
const baseConfig = require('../../eslint.config.js'); | ||
|
||
module.exports = [ | ||
...baseConfig, | ||
{ | ||
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], | ||
rules: {}, | ||
}, | ||
{ | ||
files: ['src/plugins/index.js'], | ||
rules: { | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'no-undef': 'off', | ||
}, | ||
}, | ||
]; |
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
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,17 @@ | ||
const { FlatCompat } = require('@eslint/eslintrc'); | ||
const baseConfig = require('../../eslint.config.js'); | ||
const js = require('@eslint/js'); | ||
|
||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
}); | ||
|
||
module.exports = [ | ||
...baseConfig, | ||
...compat.extends('plugin:cypress/recommended'), | ||
{ | ||
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], | ||
rules: {}, | ||
}, | ||
]; |
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
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,69 @@ | ||
const { FlatCompat } = require('@eslint/eslintrc'); | ||
const nxEslintPlugin = require('@nx/eslint-plugin'); | ||
const js = require('@eslint/js'); | ||
|
||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
}); | ||
|
||
module.exports = [ | ||
{ plugins: { '@nx': nxEslintPlugin } }, | ||
{ | ||
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], | ||
rules: { | ||
'@nx/enforce-module-boundaries': [ | ||
'error', | ||
{ | ||
enforceBuildableLibDependency: true, | ||
allow: [], | ||
depConstraints: [ | ||
{ | ||
sourceTag: '*', | ||
onlyDependOnLibsWithTags: ['*'], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
...compat.config({ extends: ['plugin:@nx/typescript'] }).map((config) => ({ | ||
...config, | ||
files: ['**/*.ts', '**/*.tsx'], | ||
rules: {}, | ||
})), | ||
...compat.config({ extends: ['plugin:@nx/javascript'] }).map((config) => ({ | ||
...config, | ||
files: ['**/*.js', '**/*.jsx'], | ||
rules: {}, | ||
})), | ||
...compat.config({ env: { jest: true } }).map((config) => ({ | ||
...config, | ||
files: ['**/*.spec.ts', '**/*.spec.tsx', '**/*.spec.js', '**/*.spec.jsx'], | ||
rules: {}, | ||
})), | ||
...compat.config({ parser: 'jsonc-eslint-parser' }).map((config) => ({ | ||
...config, | ||
files: ['**/*.json'], | ||
rules: { | ||
'@nx/dependency-checks': [ | ||
'error', | ||
{ | ||
buildTargets: ['build'], | ||
checkMissingDependencies: true, | ||
checkObsoleteDependencies: true, | ||
checkVersionMismatches: true, | ||
ignoredDependencies: [ | ||
'jest-preset-angular', | ||
'jest-axe', | ||
'@testing-library/jest-dom', | ||
'rxjs', | ||
'@spartan-ng/ui-icon-helm', | ||
'@spartan-ng/ui-button-helm', | ||
'@spartan-ng/ui-avatar-brain', | ||
], | ||
}, | ||
], | ||
}, | ||
})), | ||
]; |
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,29 @@ | ||
const { FlatCompat } = require('@eslint/eslintrc'); | ||
const baseConfig = require('../../eslint.config.js'); | ||
const js = require('@eslint/js'); | ||
|
||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
}); | ||
|
||
module.exports = [ | ||
...baseConfig, | ||
{ | ||
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], | ||
rules: {}, | ||
}, | ||
{ | ||
files: ['**/*.ts', '**/*.tsx'], | ||
rules: {}, | ||
}, | ||
{ | ||
files: ['**/*.js', '**/*.jsx'], | ||
rules: {}, | ||
}, | ||
...compat.config({ parser: 'jsonc-eslint-parser' }).map((config) => ({ | ||
...config, | ||
files: ['./package.json', './executors.json'], | ||
rules: { '@nx/nx-plugin-checks': 'error' }, | ||
})), | ||
]; |
Oops, something went wrong.