Skip to content

Commit

Permalink
Upgraded to flat eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPshul committed Oct 8, 2024
1 parent 3e842cd commit 5746665
Show file tree
Hide file tree
Showing 10 changed files with 435 additions and 132 deletions.
53 changes: 0 additions & 53 deletions .eslintrc.json

This file was deleted.

59 changes: 59 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const { FlatCompat } = require('@eslint/eslintrc');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');

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: {
...config.rules,
'no-extra-semi': 'error',
},
})),
...compat.config({ extends: ['plugin:@nx/javascript'] }).map(config => ({
...config,
files: ['**/*.js', '**/*.jsx'],
rules: {
...config.rules,
'no-extra-semi': 'error',
},
})),
...compat.config({ env: { jest: true } }).map(config => ({
...config,
files: ['**/*.spec.ts', '**/*.spec.tsx', '**/*.spec.js', '**/*.spec.jsx'],
rules: {
...config.rules,
},
})),
{
files: ['**/*.json'],
// Override or add rules here
rules: {},
languageOptions: { parser: require('jsonc-eslint-parser') },
},
];
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependsOn": ["^build"]
},
"lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"]
"inputs": ["default", "{workspaceRoot}/eslint.config.js"]
},
"test": {
"inputs": ["default", "^default", "{workspaceRoot}/jest.preset.js"]
Expand Down
Loading

0 comments on commit 5746665

Please sign in to comment.