Skip to content

Commit e4f2bc2

Browse files
committed
chore: adopt eslint 9 changes
1 parent 20d606b commit e4f2bc2

File tree

79 files changed

+4280
-3259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+4280
-3259
lines changed

.eslintignore

Lines changed: 0 additions & 16 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 69 deletions
This file was deleted.

babel.config.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module.exports = {
22
presets: [
3-
[
4-
'@babel/env',
5-
{
6-
targets: '> 0.25%, not dead'
7-
}
8-
]
9-
]
10-
}
3+
[
4+
'@babel/env',
5+
{
6+
targets: '> 0.25%, not dead',
7+
},
8+
],
9+
],
10+
};

eslint.config.js

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
const path = require('path');
2+
const rulesDirPlugin = require('eslint-plugin-rulesdir');
3+
rulesDirPlugin.RULES_DIR = path.resolve(__dirname, './packages/eslint-config/lib/rules');
4+
const prettierPlugin = require('eslint-plugin-prettier');
5+
const nxPlugin = require('@nx/eslint-plugin');
6+
const { defineConfig } = require('eslint/config');
7+
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
8+
const tsPlugin = require('@typescript-eslint/eslint-plugin');
9+
const reactPlugin = require('eslint-plugin-react');
10+
const jsonPlugin = require('eslint-plugin-json');
11+
const fecPlugin = require('./packages/eslint-config/index')
12+
13+
const basePlugins = {
14+
rulesdir: rulesDirPlugin,
15+
prettier: prettierPlugin,
16+
'@nx': nxPlugin,
17+
'@typescript-eslint': tsPlugin,
18+
'typescript-eslint': tsPlugin,
19+
react: reactPlugin,
20+
};
21+
22+
module.exports.basePlugins = basePlugins;
23+
24+
module.exports = defineConfig(
25+
eslintPluginPrettierRecommended,
26+
reactPlugin.configs.flat.recommended,
27+
fecPlugin,
28+
{
29+
ignores: [
30+
'src/demoData',
31+
'doc/',
32+
'node_modules/',
33+
'packages/*/**/*.js',
34+
'!packages/eslint-config/**/*.js',
35+
'!packages/config/*.js',
36+
'!packages/docs/**/*.js',
37+
'!packages/*/src/**/*.js',
38+
'!packages/create-crc-app/bin/**/*.js',
39+
'!packages/create-crc-app/templates/**/*.js',
40+
'packages/create-crc-app/templates/fec.config.js',
41+
'src/SmartComponents/SamplePage/',
42+
'node_modules',
43+
'**/*',
44+
'!eslint.config.js',
45+
],
46+
plugins: {
47+
rulesdir: rulesDirPlugin,
48+
prettier: prettierPlugin,
49+
'@nx': nxPlugin,
50+
'@typescript-eslint': tsPlugin,
51+
'typescript-eslint': tsPlugin,
52+
react: reactPlugin,
53+
json: jsonPlugin,
54+
},
55+
extends: ['json/recommended'],
56+
languageOptions: {
57+
globals: {
58+
insights: 'readonly',
59+
},
60+
},
61+
rules: {
62+
'@nx/dependency-checks': 'off',
63+
'no-prototype-builtins': 'off',
64+
'sort-imports': [
65+
2,
66+
{
67+
ignoreDeclarationSort: true,
68+
},
69+
],
70+
'react/no-unknown-property': ['error', { ignore: ['widget-type', 'widget-id', 'page-type', 'ouiaId'] }],
71+
'@typescript-eslint/ban-ts-comment': 'off',
72+
},
73+
},
74+
{
75+
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
76+
rules: {
77+
'@nx/enforce-module-boundaries': 'off',
78+
'no-use-before-define': 'off',
79+
'@typescript-eslint/no-use-before-define': ['error'],
80+
'react/prop-types': 'off',
81+
'@typescript-eslint/ban-ts-comment': 'off',
82+
'@typescript-eslint/no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
83+
},
84+
plugins: {
85+
'@typescript-eslint': tsPlugin,
86+
},
87+
},
88+
{
89+
files: ['*.ts', '*.tsx'],
90+
rules: {
91+
'react/react-in-jsx-scope': 'off',
92+
'react/prop-types': 'off',
93+
'no-prototype-builtins': 'off',
94+
'@typescript-eslint/ban-ts-comment': 'off',
95+
},
96+
},
97+
{
98+
files: ['*.js', '*.jsx'],
99+
rules: {
100+
'no-prototype-builtins': 'off',
101+
'react/react-in-jsx-scope': 'off',
102+
},
103+
},
104+
{
105+
files: ['*.spec.ts', '*.spec.tsx', '*.spec.js', '*.spec.jsx', '*.test.ts', '*.test.tsx', '*.test.js', '*.test.jsx'],
106+
env: {
107+
jest: true,
108+
},
109+
rules: {},
110+
},
111+
{
112+
files: ['*.ct.js', '*.ct.jsx', '*.ct.ts', '*.ct.tsx', '*.cy.js', '*.cy.jsx', '*.cy.ts', '*.cy.tsx'],
113+
plugins: {
114+
cypress: require('eslint-plugin-cypress'),
115+
},
116+
},
117+
);

examples/demo/.eslintrc.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/demo/eslint.config.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const { defineConfig } = require("eslint/config");
2+
const nxPlugin = require('@nx/eslint-plugin');
3+
const fecConfig = require('../../eslint.config');
4+
const tsPlugin = require('@typescript-eslint/eslint-plugin');
5+
6+
module.exports = defineConfig(
7+
// fecConfig,
8+
{
9+
plugins: {
10+
'@nx': nxPlugin,
11+
'typescript-eslint': tsPlugin,
12+
},
13+
// "extends": ["@nx/react"],
14+
ignores: ["!**/*"],
15+
}
16+
// {
17+
// "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
18+
// "rules": {}
19+
// },
20+
// {
21+
// "files": ["*.ts", "*.tsx"],
22+
// "rules": {}
23+
// },
24+
// {
25+
// "files": ["*.js", "*.jsx"],
26+
// "rules": {}
27+
// }
28+
)

0 commit comments

Comments
 (0)