Skip to content

Uds 1443 - Eslint update and move shared to it's own package #1548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

123 changes: 0 additions & 123 deletions .eslintrc.base.js

This file was deleted.

36 changes: 0 additions & 36 deletions .eslintrc.js

This file was deleted.

3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"titleBar.activeForeground": "#FFC627",
"titleBar.inactiveBackground": "#8C1D40",
"titleBar.inactiveForeground": "#D0D0D0"
}
},
"typescript.tsdk": "node_modules/typescript/lib"
}
190 changes: 190 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
const globals = require("globals");
const react = require("eslint-plugin-react");
const jest = require("eslint-plugin-jest");
const tsParser = require("@typescript-eslint/parser");
const typescriptEslint = require("@typescript-eslint/eslint-plugin");
const js = require("@eslint/js");
const importPlugin = require("eslint-plugin-import");
const jsxA11y = require("eslint-plugin-jsx-a11y");
const prettier = require("eslint-plugin-prettier");

module.exports = [
js.configs.recommended,
{
files: ["**/*.{js,jsx}"],
languageOptions: {
globals: {
...globals.browser,
...globals.jest,
},
ecmaVersion: 13,
sourceType: "module",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
react,
jest,
import: importPlugin,
"jsx-a11y": jsxA11y,
prettier,
},
settings: {
react: {
version: "detect",
},
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
},
rules: {
// React rules
"react/function-component-definition": "off",
"react/jsx-filename-extension": "off",
"react/jsx-no-constructed-context-values": "off",
"react/jsx-no-useless-fragment": "off",
"react/require-default-props": "off",
"react/jsx-props-no-spreading": "off",

// Import rules
"import/no-relative-packages": "off",
"import/prefer-default-export": "off",
"import/no-extraneous-dependencies": ["error", {
devDependencies: true,
}],
"import/no-relative-path-imports": "off",
"import/no-absolute-path": "off",

// JSX A11y rules
"jsx-a11y/control-has-associated-label": "off",
"jsx-a11y/label-has-associated-control": "off", // Disabled due to too many false positives

// General rules
"no-restricted-exports": "off",
"no-unsafe-optional-chaining": "off",
"no-promise-executor-return": "off",
"default-param-last": "off",
"dot-notation": "off",
"no-console": 1,
"no-unused-vars": ["warn", {
argsIgnorePattern: "^_",
varsIgnorePattern: "^(React|_)",
}],
"no-undef": "off", // Disable for config files and test files

// Import rules - disable problematic ones
"import/no-extraneous-dependencies": "off",

// Prettier
"prettier/prettier": ["error", {}, {
usePrettierrc: true,
}],
},
},
{
files: ["**/*.{ts,tsx}"],
languageOptions: {
parser: tsParser,
globals: {
...globals.browser,
...globals.jest,
},
ecmaVersion: 13,
sourceType: "module",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
react,
jest,
"@typescript-eslint": typescriptEslint,
import: importPlugin,
"jsx-a11y": jsxA11y,
prettier,
},
settings: {
react: {
version: "detect",
},
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
},
rules: {
// Inherit JS rules
...js.configs.recommended.rules,

// TypeScript specific rules
"import/extensions": ["error", "ignorePackages", {
js: "never",
jsx: "never",
ts: "never",
tsx: "never",
}],
"import/prefer-default-export": "off",
"react/jsx-filename-extension": ["error", {
extensions: [".js", ".jsx", ".ts", ".tsx"],
}],
"@typescript-eslint/ban-ts-comment": ["warn"],
"no-unused-vars": "off",
"react/require-default-props": "off",
"@typescript-eslint/no-unused-vars": ["error", {
argsIgnorePattern: "^_",
varsIgnorePattern: "^(React|_)",
}],
"@typescript-eslint/no-empty-function": "off",

// Re-apply common rules for TypeScript files
"react/function-component-definition": "off",
"import/no-relative-packages": "off",
"jsx-a11y/control-has-associated-label": "off",
"react/jsx-no-constructed-context-values": "off",
"no-restricted-exports": "off",
"react/jsx-no-useless-fragment": "off",
"no-unsafe-optional-chaining": "off",
"no-promise-executor-return": "off",
"default-param-last": "off",
"react/jsx-props-no-spreading": "off",
"prettier/prettier": ["error", {}, {
usePrettierrc: true,
}],
"dot-notation": "off",
"no-console": 1,
"import/no-extraneous-dependencies": ["error", {
devDependencies: true,
}],
"import/no-relative-path-imports": "off",
"jsx-a11y/label-has-associated-control": "off", // Disabled due to too many false positives
"import/no-absolute-path": "off",
},
},
{
ignores: [
"**/node_modules",
"**/build",
"**/dist",
"**/lib",
"**/esm",
"**/*.spec.ts",
"**/*spec.ts",
"**/*.d.ts",
"**/graphql-schema.ts",
"vite.config.*"
],
},
];
Loading