Skip to content

Commit 328f647

Browse files
authored
FEC-739: fix(templates): migrate to ESLint 9 flat config format (#3954)
* fix(templates): migrate to ESLint 9 flat config format Replace legacy .eslintrc.js with eslint.config.js across all 4 starter templates. Upgrade eslint to ^9.0.0 and remove @types/eslint <9 resolution. Fixes FEC-739 * chore(templates): remove unnecessary jest-runner-eslint pnpm override jest-runner-eslint@2.3.0 works with ESLint 9 without an explicit override, as confirmed by the monorepo root running the same setup successfully. * chore: update lockfile for eslint ^9.0.0 in templates
1 parent 964c938 commit 328f647

File tree

13 files changed

+117
-264
lines changed

13 files changed

+117
-264
lines changed

application-templates/starter-typescript/.eslintrc.js

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
process.env.ENABLE_NEW_JSX_TRANSFORM = 'true';
2+
3+
const graphqlPlugin = require('@graphql-eslint/eslint-plugin');
4+
const mcAppConfig = require('@commercetools-frontend/eslint-config-mc-app');
5+
6+
module.exports = [
7+
...mcAppConfig,
8+
{
9+
files: ['**/*.ctp.graphql'],
10+
plugins: { '@graphql-eslint': graphqlPlugin },
11+
languageOptions: {
12+
parser: graphqlPlugin,
13+
parserOptions: {
14+
graphQLConfig: {
15+
schema: './schemas/ctp.json',
16+
},
17+
},
18+
},
19+
rules: {
20+
'@graphql-eslint/known-type-names': 'error',
21+
'@graphql-eslint/known-argument-names': 'error',
22+
'@graphql-eslint/known-directives': 'error',
23+
'@graphql-eslint/scalar-leafs': 'error',
24+
},
25+
},
26+
{
27+
files: ['eslint.config.js'],
28+
rules: { 'import/extensions': 'off' },
29+
},
30+
];

application-templates/starter-typescript/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"@types/react-router": "^5.1.20",
7070
"@types/react-router-dom": "^5.3.3",
7171
"@types/testing-library__jest-dom": "^5.14.9",
72-
"eslint": "8.57.1",
72+
"eslint": "^9.0.0",
7373
"eslint-formatter-pretty": "4.1.0",
7474
"formik": "2.4.6",
7575
"graphql": "^16.8.0",
@@ -95,7 +95,6 @@
9595
"resolutions": {
9696
"@emotion/react": "^11.14.0",
9797
"@emotion/styled": "^11.14.0",
98-
"@types/eslint": "<9",
9998
"@types/react-router": "<6",
10099
"@types/react-router-dom": "<6",
101100
"headers-polyfill": "3.2.5",

application-templates/starter/.eslintrc.js

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
process.env.ENABLE_NEW_JSX_TRANSFORM = 'true';
2+
3+
const mcAppConfig = require('@commercetools-frontend/eslint-config-mc-app');
4+
5+
module.exports = [
6+
...mcAppConfig,
7+
{
8+
files: ['**/*.{js,jsx,tsx}'],
9+
rules: {
10+
'react/jsx-uses-react': 'off',
11+
'react/react-in-jsx-scope': 'off',
12+
},
13+
},
14+
{
15+
files: ['eslint.config.js'],
16+
rules: { 'import/extensions': 'off' },
17+
},
18+
];

application-templates/starter/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"@types/react-router": "^5.1.20",
6868
"@types/react-router-dom": "^5.3.3",
6969
"@types/testing-library__jest-dom": "^5.14.9",
70-
"eslint": "8.57.1",
70+
"eslint": "^9.0.0",
7171
"eslint-formatter-pretty": "4.1.0",
7272
"formik": "2.4.6",
7373
"graphql": "^16.8.0",
@@ -93,7 +93,6 @@
9393
"resolutions": {
9494
"@emotion/react": "^11.14.0",
9595
"@emotion/styled": "^11.14.0",
96-
"@types/eslint": "<9",
9796
"@types/react-router": "<6",
9897
"@types/react-router-dom": "<6",
9998
"headers-polyfill": "3.2.5",

custom-views-templates/starter-typescript/.eslintrc.js

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
process.env.ENABLE_NEW_JSX_TRANSFORM = 'true';
2+
3+
const graphqlPlugin = require('@graphql-eslint/eslint-plugin');
4+
const mcAppConfig = require('@commercetools-frontend/eslint-config-mc-app');
5+
6+
module.exports = [
7+
...mcAppConfig,
8+
{
9+
files: ['**/*.ctp.graphql'],
10+
plugins: { '@graphql-eslint': graphqlPlugin },
11+
languageOptions: {
12+
parser: graphqlPlugin,
13+
parserOptions: {
14+
graphQLConfig: {
15+
schema: './schemas/ctp.json',
16+
},
17+
},
18+
},
19+
rules: {
20+
'@graphql-eslint/known-type-names': 'error',
21+
'@graphql-eslint/known-argument-names': 'error',
22+
'@graphql-eslint/known-directives': 'error',
23+
'@graphql-eslint/scalar-leafs': 'error',
24+
},
25+
},
26+
{
27+
files: ['eslint.config.js'],
28+
rules: { 'import/extensions': 'off' },
29+
},
30+
];

custom-views-templates/starter-typescript/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"@types/react-router": "^5.1.20",
7070
"@types/react-router-dom": "^5.3.3",
7171
"@types/testing-library__jest-dom": "^5.14.9",
72-
"eslint": "8.57.1",
72+
"eslint": "^9.0.0",
7373
"eslint-formatter-pretty": "4.1.0",
7474
"formik": "2.4.6",
7575
"graphql": "^16.8.0",
@@ -95,7 +95,6 @@
9595
"resolutions": {
9696
"@emotion/react": "^11.14.0",
9797
"@emotion/styled": "^11.14.0",
98-
"@types/eslint": "<9",
9998
"@types/react-router": "<6",
10099
"@types/react-router-dom": "<6",
101100
"headers-polyfill": "3.2.5",

custom-views-templates/starter/.eslintrc.js

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

0 commit comments

Comments
 (0)