Skip to content

Commit a3ea820

Browse files
authored
Release 15.1.0 (#168)
* chore: prepare next dev release * feat: stricter ESLint config (#167) ### Developer Checklist (Definition of Done) **Issue** - [ ] All acceptance criteria from the issue are met - [ ] Tested in latest Chrome/Firefox **UI/UX/Vis** - [ ] Requires UI/UX/Vis review - [ ] Reviewer(s) are notified (_tag assignees_) - [ ] Review has occurred (_link to notes_) - [ ] Feedback is included in this PR - [ ] Reviewer(s) approve of concept and design **Code** - [ ] Branch is up-to-date with the branch to be merged with, i.e., develop - [ ] Code is cleaned up and formatted - [ ] Unit tests are written (frontend/backend if applicable) - [ ] Integration tests are written (if applicable) **PR** - [ ] Descriptive title for this pull request is provided (will be used for release notes later) - [ ] Reviewer and assignees are defined - [ ] Add type label (e.g., *bug*, *feature*) to this pull request - [ ] Add release label (e.g., `release: minor`) to this PR following [semver](https://semver.org/) - [ ] The PR is connected to the corresponding issue (via `Closes #...`) - [ ] [Summary of changes](#summary-of-changes) is written ### Summary of changes - Create a stricter ESLint config - Split into two PRs to ease the migration ### Screenshots ### Additional notes for the reviewer(s) - Thanks for creating this pull request 🤗 * Prepare release version 15.1.0 --------- Co-authored-by: datavisyn-bot <> Co-authored-by: Michael Pühringer <[email protected]>
2 parents 31ad691 + 70edbff commit a3ea820

File tree

3 files changed

+128
-203
lines changed

3 files changed

+128
-203
lines changed

config/eslint.config.template.js

Lines changed: 95 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,76 @@
11
const { defineConfig } = require('eslint/config');
2-
const js = require('@eslint/js');
2+
const { includeIgnoreFile } = require('@eslint/compat');
3+
const { rules: prettierConfigRules } = require('eslint-config-prettier');
4+
const airbnb = require('eslint-config-airbnb-extended');
35
const globals = require('globals');
4-
const importPlugin = require('eslint-plugin-import');
6+
const jest = require('eslint-plugin-jest');
7+
const js = require('@eslint/js');
58
const jsxA11y = require('eslint-plugin-jsx-a11y');
6-
const react = require('eslint-plugin-react');
7-
const reactHooks = require('eslint-plugin-react-hooks');
9+
const path = require('node:path');
10+
const playwright = require('eslint-plugin-playwright');
11+
const prettierPlugin = require('eslint-plugin-prettier');
812
const reactCompiler = require('eslint-plugin-react-compiler');
913
const unusedImports = require('eslint-plugin-unused-imports');
10-
const pluginJest = require('eslint-plugin-jest');
11-
const playwright = require('eslint-plugin-playwright');
12-
const airbnb = require('eslint-config-airbnb-extended/legacy');
13-
const prettierRecommended = require('eslint-plugin-prettier/recommended');
14+
15+
const jsConfig = [
16+
{
17+
name: 'js/config',
18+
...js.configs.recommended,
19+
},
20+
airbnb.plugins.stylistic,
21+
airbnb.plugins.importX,
22+
...airbnb.configs.base.recommended,
23+
];
24+
25+
const reactConfig = [
26+
reactCompiler.configs.recommended,
27+
airbnb.plugins.react,
28+
airbnb.plugins.reactHooks,
29+
airbnb.plugins.reactA11y,
30+
...airbnb.configs.react.recommended,
31+
];
32+
33+
const typescriptConfig = [
34+
// TypeScript ESLint Plugin
35+
airbnb.plugins.typescriptEslint,
36+
// Airbnb Base TypeScript Config
37+
...airbnb.configs.base.typescript,
38+
// Airbnb React TypeScript Config
39+
...airbnb.configs.react.typescript,
40+
];
41+
42+
const prettierConfig = [
43+
{
44+
name: 'prettier/plugin/config',
45+
plugins: {
46+
prettier: prettierPlugin,
47+
},
48+
},
49+
{
50+
name: 'prettier/config',
51+
rules: {
52+
...prettierConfigRules,
53+
'prettier/prettier': 'error',
54+
},
55+
},
56+
];
57+
58+
const jestConfig = [
59+
{
60+
files: ['{src|tests}/**/*.{test|spec}.ts'],
61+
plugins: { jest },
62+
languageOptions: {
63+
globals: jest.environments.globals.globals,
64+
},
65+
},
66+
];
67+
68+
const playwrightConfig = [
69+
{
70+
...playwright.configs['flat/recommended'],
71+
files: ['playwright/**/*.{test|spec}.ts'],
72+
},
73+
];
1474

1575
// Helper to disable jsx-a11y rules
1676
const jsxA11yOffRules = Object.keys(jsxA11y.rules).reduce((acc, rule) => {
@@ -20,14 +80,13 @@ const jsxA11yOffRules = Object.keys(jsxA11y.rules).reduce((acc, rule) => {
2080

2181
module.exports = ({ tsconfigRootDir }) =>
2282
defineConfig(
23-
js.configs.recommended,
24-
...airbnb.configs.react.typescript,
25-
importPlugin.flatConfigs.recommended,
26-
react.configs.flat.recommended,
27-
reactHooks.configs.flat.recommended,
28-
reactCompiler.configs.recommended,
29-
prettierRecommended,
30-
83+
includeIgnoreFile(path.resolve('.', '.gitignore')),
84+
...jsConfig,
85+
...reactConfig,
86+
...typescriptConfig,
87+
...prettierConfig,
88+
...jestConfig,
89+
...playwrightConfig,
3190
{
3291
files: ['**/*.{ts,tsx,cts,mts}'],
3392
plugins: {
@@ -56,10 +115,12 @@ module.exports = ({ tsconfigRootDir }) =>
56115

57116
rules: {
58117
...jsxA11yOffRules,
118+
'arrow-body-style': 'off',
59119
'class-methods-use-this': 'off',
60-
'@typescript-eslint/class-methods-use-this': 'off',
61120
curly: [2, 'all'],
62121
'linebreak-style': 'off',
122+
'no-promise-executor-return': 'warn',
123+
'no-await-in-loop': 'warn',
63124
'no-console': 'off',
64125
'no-continue': 'off',
65126
'no-multi-assign': 'warn',
@@ -96,6 +157,14 @@ module.exports = ({ tsconfigRootDir }) =>
96157
],
97158
},
98159
],
160+
'prefer-arrow-callback': 'warn',
161+
'@typescript-eslint/consistent-indexed-object-style': 'off',
162+
'@typescript-eslint/consistent-type-definitions': 'off',
163+
'@typescript-eslint/ban-ts-comment': 'warn',
164+
'@typescript-eslint/class-methods-use-this': 'off',
165+
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
166+
'@typescript-eslint/no-empty-object-type': 'warn',
167+
'@typescript-eslint/prefer-destructuring': 'warn',
99168
'@typescript-eslint/no-shadow': 'warn',
100169
'@typescript-eslint/no-use-before-define': 'warn',
101170
'@typescript-eslint/no-explicit-any': 'warn',
@@ -118,11 +187,11 @@ module.exports = ({ tsconfigRootDir }) =>
118187
],
119188
'max-classes-per-file': 'off',
120189
'no-param-reassign': ['warn', { props: true, ignorePropertyModificationsFor: ['state'] }],
121-
'import/no-extraneous-dependencies': 'off',
122-
'import/no-webpack-loader-syntax': 'off',
123-
'import/no-unresolved': 'off',
124-
'import/prefer-default-export': 'off',
125-
'import/order': [
190+
'import-x/no-extraneous-dependencies': 'off',
191+
'import-x/no-webpack-loader-syntax': 'off',
192+
'import-x/no-unresolved': 'off',
193+
'import-x/prefer-default-export': 'off',
194+
'import-x/order': [
126195
'error',
127196
{
128197
groups: [['builtin', 'external'], 'internal', ['sibling', 'parent']],
@@ -152,11 +221,14 @@ module.exports = ({ tsconfigRootDir }) =>
152221
'unused-imports/no-unused-imports': 'error',
153222
'unused-imports/no-unused-vars': 'off',
154223
'prefer-destructuring': ['warn', { object: true, array: false }],
224+
'prefer-rest-params': 'warn',
155225
'prefer-promise-reject-errors': 'warn',
156226
'prefer-spread': 'warn',
157-
'@typescript-eslint/ban-ts-comment': 'warn',
158227
// Not required with the new JSX transform
159228
'react/react-in-jsx-scope': 'off',
229+
'react/no-array-index-key': 'warn',
230+
'react/jsx-no-useless-fragment': 'warn',
231+
'react/jsx-pascal-case': 'warn',
160232
'react/destructuring-assignment': 'off',
161233
'react/jsx-curly-brace-presence': 'warn',
162234
'react/jsx-props-no-spreading': 'off',
@@ -192,17 +264,4 @@ module.exports = ({ tsconfigRootDir }) =>
192264
'@stylistic/comma-dangle': 'off',
193265
},
194266
},
195-
196-
{
197-
files: ['{src|tests}/**/*.{test|spec}.ts'],
198-
plugins: { jest: pluginJest },
199-
languageOptions: {
200-
globals: pluginJest.environments.globals.globals,
201-
},
202-
},
203-
204-
{
205-
...playwright.configs['flat/recommended'],
206-
files: ['playwright/**/*.{test|spec}.ts'],
207-
},
208267
);

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "visyn_scripts",
33
"description": "",
4-
"version": "15.0.0",
4+
"version": "15.1.0",
55
"author": {
66
"name": "datavisyn GmbH",
77
"email": "[email protected]",
@@ -64,8 +64,6 @@
6464
"eslint-config-airbnb-extended": "^2.3.2",
6565
"eslint-config-prettier": "^10.1.8",
6666
"eslint-import-resolver-typescript": "^4.4.4",
67-
"eslint-plugin-chai-friendly": "^1.1.0",
68-
"eslint-plugin-import": "^2.32.0",
6967
"eslint-plugin-import-x": "^4.16.1",
7068
"eslint-plugin-jest": "^29.0.1",
7169
"eslint-plugin-jsx-a11y": "^6.10.2",

0 commit comments

Comments
 (0)