Skip to content

Commit

Permalink
OS-7823. Update eslint to v9
Browse files Browse the repository at this point in the history
  • Loading branch information
ek-hystax authored Jan 9, 2025
1 parent effaa52 commit fe2bae3
Show file tree
Hide file tree
Showing 22 changed files with 7,885 additions and 11,340 deletions.
3 changes: 1 addition & 2 deletions jira_ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ WORKDIR /usr/src/app/ui
COPY jira_ui/ui/package*.json ./
RUN npm ci --ignore-scripts --legacy-peer-deps
COPY jira_ui/ui/ ./
# .eslintrc.json on build step will produce an error, but it is still needed on testing
RUN mv .eslintrc.json .disabled.eslintrc.json
RUN mv eslint.config.mjs eslint.config.mjs
RUN npm run build && rm -rf node_modules

# -------- Server --------
Expand Down
1 change: 0 additions & 1 deletion jira_ui/Dockerfile_tests
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ FROM jira_ui:${BUILDTAG}
WORKDIR "/usr/src/app/ui"
USER root

RUN mv .disabled.eslintrc.json .eslintrc.json
RUN npm ci --legacy-peer-deps --ignore-scripts -D
2 changes: 0 additions & 2 deletions jira_ui/ui/.eslintignore

This file was deleted.

102 changes: 0 additions & 102 deletions jira_ui/ui/.eslintrc.json

This file was deleted.

142 changes: 142 additions & 0 deletions jira_ui/ui/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import babelParser from "@babel/eslint-parser";
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintPluginImport from "eslint-plugin-import";
import eslintPluginPrettier from "eslint-plugin-prettier";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import unusedImportsPlugin from "eslint-plugin-unused-imports";
import globals from "globals";

const extensions = ["js", "jsx"];

export default [
{
files: [`src/**/*.{${extensions.join(",")}}`],
plugins: {
react: reactPlugin,
"react-hooks": reactHooksPlugin,
import: eslintPluginImport,
"unused-imports": unusedImportsPlugin,
prettier: eslintPluginPrettier
},
languageOptions: {
parser: babelParser,
parserOptions: {
requireConfigFile: false,
babelOptions: {
babelrc: false,
configFile: false,
presets: ["@babel/preset-react"]
}
},
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.browser,
...globals.builtin
}
},
settings: {
"import/resolver": {
node: {
extensions: extensions.map((extension) => `.${extension}`),
moduleDirectory: ["node_modules", "src/"]
}
},
react: {
version: "detect"
}
},
rules: {
...js.configs.recommended.rules,
...reactPlugin.configs.flat.recommended.rules,
...reactHooksPlugin.configs.recommended.rules,
"class-methods-use-this": "error",
"no-param-reassign": [
"error",
{
props: true,
ignorePropertyModificationsFor: [
"acc", // for reduce accumulators
"accumulator", // for reduce accumulators
"ctx" // for canvas context
]
}
],
"no-underscore-dangle": [
"error",
{
allowAfterThis: true,
allowAfterThisConstructor: true
}
],
"jsx-quotes": "warn",
"no-multi-spaces": "warn",
"no-const-assign": "warn",
"constructor-super": "warn",
"valid-typeof": "warn",
"no-extra-semi": "warn",
"comma-dangle": [
"warn",
{
arrays: "never",
objects: "never"
}
],
"max-params": ["warn", 3],
"no-this-before-super": "warn",
"no-undef": "warn",
"no-unreachable": "warn",
"no-bitwise": "off",
"no-console": "off",
"default-param-last": "off",

"unused-imports/no-unused-imports": "warn",

"react/jsx-uses-vars": "error",
"react/no-typos": "warn",
"react/jsx-tag-spacing": "warn",
"react/jsx-boolean-value": "warn",
"react/no-array-index-key": "warn",
"react/jsx-wrap-multilines": "warn",
"react/self-closing-comp": "warn",
"react/jsx-closing-bracket-location": "warn",
"react/require-render-return": "warn",
"react/prefer-es6-class": "warn",
"react/prefer-stateless-function": "warn",
"react/jsx-uses-react": "warn",
"react/no-multi-comp": "off",
"react/display-name": "off",
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",

"import/order": [
"warn",
{
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],

pathGroups: [
{
pattern: "react",
group: "builtin",
position: "before"
}
],

pathGroupsExcludedImportTypes: ["react"],

alphabetize: {
order: "asc",
caseInsensitive: true
}
}
],
"import/no-extraneous-dependencies": "off",
"import/prefer-default-export": "off",

"prettier/prettier": "error",
...eslintConfigPrettier.rules
}
}
];
Loading

0 comments on commit fe2bae3

Please sign in to comment.