Skip to content

Commit abf792c

Browse files
Merge pull request #1548 from ASU/uds-1443
Uds 1443 - Eslint update and move shared to it's own package
2 parents 870e6b8 + 3cb2721 commit abf792c

File tree

595 files changed

+5969
-17809
lines changed

Some content is hidden

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

595 files changed

+5969
-17809
lines changed

.eslintignore

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

.eslintrc.base.js

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

.eslintrc.js

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

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
"titleBar.activeForeground": "#FFC627",
1616
"titleBar.inactiveBackground": "#8C1D40",
1717
"titleBar.inactiveForeground": "#D0D0D0"
18-
}
18+
},
19+
"typescript.tsdk": "node_modules/typescript/lib"
1920
}

eslint.config.js

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
const globals = require("globals");
2+
const react = require("eslint-plugin-react");
3+
const jest = require("eslint-plugin-jest");
4+
const tsParser = require("@typescript-eslint/parser");
5+
const typescriptEslint = require("@typescript-eslint/eslint-plugin");
6+
const js = require("@eslint/js");
7+
const importPlugin = require("eslint-plugin-import");
8+
const jsxA11y = require("eslint-plugin-jsx-a11y");
9+
const prettier = require("eslint-plugin-prettier");
10+
11+
module.exports = [
12+
js.configs.recommended,
13+
{
14+
files: ["**/*.{js,jsx}"],
15+
languageOptions: {
16+
globals: {
17+
...globals.browser,
18+
...globals.jest,
19+
},
20+
ecmaVersion: 13,
21+
sourceType: "module",
22+
parserOptions: {
23+
ecmaFeatures: {
24+
jsx: true,
25+
},
26+
},
27+
},
28+
plugins: {
29+
react,
30+
jest,
31+
import: importPlugin,
32+
"jsx-a11y": jsxA11y,
33+
prettier,
34+
},
35+
settings: {
36+
react: {
37+
version: "detect",
38+
},
39+
"import/resolver": {
40+
node: {
41+
extensions: [".js", ".jsx", ".ts", ".tsx"],
42+
},
43+
},
44+
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
45+
},
46+
rules: {
47+
// React rules
48+
"react/function-component-definition": "off",
49+
"react/jsx-filename-extension": "off",
50+
"react/jsx-no-constructed-context-values": "off",
51+
"react/jsx-no-useless-fragment": "off",
52+
"react/require-default-props": "off",
53+
"react/jsx-props-no-spreading": "off",
54+
55+
// Import rules
56+
"import/no-relative-packages": "off",
57+
"import/prefer-default-export": "off",
58+
"import/no-extraneous-dependencies": ["error", {
59+
devDependencies: true,
60+
}],
61+
"import/no-relative-path-imports": "off",
62+
"import/no-absolute-path": "off",
63+
64+
// JSX A11y rules
65+
"jsx-a11y/control-has-associated-label": "off",
66+
"jsx-a11y/label-has-associated-control": "off", // Disabled due to too many false positives
67+
68+
// General rules
69+
"no-restricted-exports": "off",
70+
"no-unsafe-optional-chaining": "off",
71+
"no-promise-executor-return": "off",
72+
"default-param-last": "off",
73+
"dot-notation": "off",
74+
"no-console": 1,
75+
"no-unused-vars": ["warn", {
76+
argsIgnorePattern: "^_",
77+
varsIgnorePattern: "^(React|_)",
78+
}],
79+
"no-undef": "off", // Disable for config files and test files
80+
81+
// Import rules - disable problematic ones
82+
"import/no-extraneous-dependencies": "off",
83+
84+
// Prettier
85+
"prettier/prettier": ["error", {}, {
86+
usePrettierrc: true,
87+
}],
88+
},
89+
},
90+
{
91+
files: ["**/*.{ts,tsx}"],
92+
languageOptions: {
93+
parser: tsParser,
94+
globals: {
95+
...globals.browser,
96+
...globals.jest,
97+
},
98+
ecmaVersion: 13,
99+
sourceType: "module",
100+
parserOptions: {
101+
ecmaFeatures: {
102+
jsx: true,
103+
},
104+
},
105+
},
106+
plugins: {
107+
react,
108+
jest,
109+
"@typescript-eslint": typescriptEslint,
110+
import: importPlugin,
111+
"jsx-a11y": jsxA11y,
112+
prettier,
113+
},
114+
settings: {
115+
react: {
116+
version: "detect",
117+
},
118+
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
119+
"import/parsers": {
120+
"@typescript-eslint/parser": [".ts", ".tsx"],
121+
},
122+
"import/resolver": {
123+
node: {
124+
extensions: [".js", ".jsx", ".ts", ".tsx"],
125+
},
126+
},
127+
},
128+
rules: {
129+
// Inherit JS rules
130+
...js.configs.recommended.rules,
131+
132+
// TypeScript specific rules
133+
"import/extensions": ["error", "ignorePackages", {
134+
js: "never",
135+
jsx: "never",
136+
ts: "never",
137+
tsx: "never",
138+
}],
139+
"import/prefer-default-export": "off",
140+
"react/jsx-filename-extension": ["error", {
141+
extensions: [".js", ".jsx", ".ts", ".tsx"],
142+
}],
143+
"@typescript-eslint/ban-ts-comment": ["warn"],
144+
"no-unused-vars": "off",
145+
"react/require-default-props": "off",
146+
"@typescript-eslint/no-unused-vars": ["error", {
147+
argsIgnorePattern: "^_",
148+
varsIgnorePattern: "^(React|_)",
149+
}],
150+
"@typescript-eslint/no-empty-function": "off",
151+
152+
// Re-apply common rules for TypeScript files
153+
"react/function-component-definition": "off",
154+
"import/no-relative-packages": "off",
155+
"jsx-a11y/control-has-associated-label": "off",
156+
"react/jsx-no-constructed-context-values": "off",
157+
"no-restricted-exports": "off",
158+
"react/jsx-no-useless-fragment": "off",
159+
"no-unsafe-optional-chaining": "off",
160+
"no-promise-executor-return": "off",
161+
"default-param-last": "off",
162+
"react/jsx-props-no-spreading": "off",
163+
"prettier/prettier": ["error", {}, {
164+
usePrettierrc: true,
165+
}],
166+
"dot-notation": "off",
167+
"no-console": 1,
168+
"import/no-extraneous-dependencies": ["error", {
169+
devDependencies: true,
170+
}],
171+
"import/no-relative-path-imports": "off",
172+
"jsx-a11y/label-has-associated-control": "off", // Disabled due to too many false positives
173+
"import/no-absolute-path": "off",
174+
},
175+
},
176+
{
177+
ignores: [
178+
"**/node_modules",
179+
"**/build",
180+
"**/dist",
181+
"**/lib",
182+
"**/esm",
183+
"**/*.spec.ts",
184+
"**/*spec.ts",
185+
"**/*.d.ts",
186+
"**/graphql-schema.ts",
187+
"vite.config.*"
188+
],
189+
},
190+
];

0 commit comments

Comments
 (0)