Skip to content

Commit ee846aa

Browse files
authored
feat(eslint): migrate to eslint 9 (#2039)
1 parent ca1c728 commit ee846aa

File tree

20 files changed

+582
-445
lines changed

20 files changed

+582
-445
lines changed

.changeset/witty-coins-promise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@scaleway/eslint-config-react': major
3+
---
4+
5+
Migrate to eslint9

.eslintignore

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

.eslintrc

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

eslint.config.mjs

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import babelParser from "@babel/eslint-parser";
2+
import scw from "@scaleway/eslint-config-react/javascript";
3+
import scwTypescript from "@scaleway/eslint-config-react/typescript";
4+
import globals from "globals";
5+
6+
export default [
7+
{
8+
ignores: [
9+
"**/node_modules/",
10+
"**/dist/",
11+
"**/build/",
12+
"**/__typetests__/",
13+
"**/packages_deprecated/",
14+
"**/coverage/",
15+
],
16+
},
17+
{
18+
languageOptions: {
19+
globals: {
20+
...globals.browser,
21+
},
22+
},
23+
},
24+
...scw.map((config) => ({ ...config, files: ["**/*.js"] })),
25+
{
26+
files: ["**/*.js"],
27+
28+
languageOptions: {
29+
parser: babelParser,
30+
parserOptions: {
31+
configFile: "./babel.config.json",
32+
},
33+
},
34+
},
35+
...scwTypescript.map((config) => ({
36+
...config,
37+
files: ["**/*.ts", "**/*.tsx"],
38+
})),
39+
40+
{
41+
files: ["**/*.ts", "**/*.tsx"],
42+
43+
languageOptions: {
44+
ecmaVersion: 5,
45+
sourceType: "script",
46+
47+
parserOptions: {
48+
project: ["tsconfig.json"],
49+
},
50+
},
51+
},
52+
...scwTypescript.map((config) => ({
53+
...config,
54+
files: [
55+
"packages/changesets-renovate/**/*.ts{x,}",
56+
"packages/validate-icu-locales/**/*.ts{x,}",
57+
"**/__tests__/**/*.ts{x,}",
58+
],
59+
60+
languageOptions: {
61+
ecmaVersion: 5,
62+
sourceType: "script",
63+
64+
parserOptions: {
65+
project: ["tsconfig.json"],
66+
},
67+
},
68+
})),
69+
...scwTypescript.map((config) => ({
70+
...config,
71+
files: [
72+
"packages/changesets-renovate/**/*.ts{x,}",
73+
"packages/validate-icu-locales/**/*.ts{x,}",
74+
"**/__tests__/**/*.ts{x,}",
75+
],
76+
77+
languageOptions: {
78+
ecmaVersion: 5,
79+
sourceType: "script",
80+
81+
parserOptions: {
82+
project: ["tsconfig.json"],
83+
},
84+
},
85+
86+
rules: {
87+
...config.rules,
88+
"no-console": "off",
89+
"@typescript-eslint/no-explicit-any": "warn",
90+
"@typescript-eslint/no-floating-promises": "warn",
91+
},
92+
})),
93+
94+
{
95+
files: [
96+
"packages/jest-helpers/**/*.ts{x,}",
97+
"**/__tests__/**/*.ts{x,}",
98+
"**/vitest.setup.ts",
99+
"**/*.config.ts",
100+
"**/__mocks__/**/*.ts{x,}",
101+
],
102+
103+
rules: {
104+
"import/no-extraneous-dependencies": "off",
105+
"react/jsx-key": "off",
106+
"import/no-relative-packages": "off",
107+
},
108+
},
109+
];

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@changesets/cli": "2.27.5",
2323
"@commitlint/cli": "19.3.0",
2424
"@commitlint/config-conventional": "19.2.2",
25+
"@eslint/eslintrc": "3.1.0",
2526
"@scaleway/eslint-config-react": "workspace:*",
2627
"@scaleway/tsconfig": "workspace:*",
2728
"@testing-library/jest-dom": "6.4.6",
@@ -36,7 +37,8 @@
3637
"builtin-modules": "4.0.0",
3738
"cross-env": "7.0.3",
3839
"esbuild-plugin-browserslist": "0.12.1",
39-
"eslint": "8.57.0",
40+
"eslint": "9.4.0",
41+
"globals": "15.4.0",
4042
"happy-dom": "14.12.0",
4143
"husky": "9.0.11",
4244
"lint-staged": "15.2.5",
@@ -51,7 +53,7 @@
5153
"wait-for-expect": "3.0.2"
5254
},
5355
"scripts": {
54-
"lint": "eslint --ext js,ts,tsx --cache .",
56+
"lint": "eslint --cache .",
5557
"lint:fix": "pnpm run lint --fix",
5658
"build": "pnpm recursive run build",
5759
"commit": "npx git-cz -a",

packages/changesets-renovate/__mocks__/simple-git.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// eslint-disable-next-line import/no-extraneous-dependencies
21
import { vi } from 'vitest'
32

43
export const defaultGitValues = {

packages/eslint-config-react/emotion.js

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { rules } from '@emotion/eslint-plugin'
2+
import { fixupPluginRules } from '@eslint/compat'
3+
4+
export default [
5+
{
6+
plugins: {
7+
'@emotion': fixupPluginRules({ rules }),
8+
},
9+
10+
rules: {
11+
'react/no-unknown-property': [
12+
'error',
13+
{
14+
ignore: ['css'],
15+
},
16+
],
17+
18+
'@emotion/import-from-emotion': 'error',
19+
'@emotion/no-vanilla': 'error',
20+
'@emotion/styled-import': 'error',
21+
'@emotion/syntax-preference': ['error', 'string'],
22+
},
23+
},
24+
]

packages/eslint-config-react/index.js

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import emotion from "./emotion.mjs";
2+
import javascript from "./javascript.mjs";
3+
import typescript from "./typescript.mjs";
4+
5+
export { emotion, javascript, typescript };

0 commit comments

Comments
 (0)