Skip to content

Commit 5654271

Browse files
committed
feat: support new config system
1 parent 8c9ec8a commit 5654271

File tree

5 files changed

+53
-0
lines changed

5 files changed

+53
-0
lines changed

configs/all.mjs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import recommended from './recommended.mjs'
2+
import legacy from '../index.js'
3+
4+
export default {
5+
...recommended,
6+
rules: legacy.configs.all.rules
7+
};

configs/jsx-runtime.mjs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import recommended from './recommended.mjs'
2+
3+
export default {
4+
...recommended,
5+
rules: {
6+
'react/react-in-jsx-scope': 0,
7+
'react/jsx-uses-react': 0,
8+
},
9+
};

configs/recommended.mjs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import react from '../index.mjs'
2+
import legacy from '../index.js'
3+
import globals from 'globals'
4+
5+
export default {
6+
files: ['**/*.{js,jsx,ts,tsx}'],
7+
globals: {
8+
...globals.serviceworker,
9+
...globals.browser,
10+
},
11+
plugins: {
12+
react
13+
},
14+
languageOptions: {
15+
parserOptions: {
16+
ecmaFeatures: {
17+
jsx: true,
18+
}
19+
},
20+
},
21+
rules: legacy.configs.recommended.rules
22+
};

index.mjs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { deprecatedRules, rules } from './index.js'
2+
3+
export default {
4+
deprecatedRules, rules
5+
}

package.json

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
"author": "Yannick Croissant <yannick.croissant+npm@gmail.com>",
55
"description": "React specific linting rules for ESLint",
66
"main": "index.js",
7+
"exports": {
8+
".": {
9+
"import": "./index.mjs",
10+
"require": "./index.js"
11+
},
12+
"./all": "./configs/all.mjs",
13+
"./jsx-runtime": "./configs/jsx-runtime.mjs",
14+
"./recommended": "./configs/recommended.mjs"
15+
},
716
"scripts": {
817
"prepack": "npmignore --auto --commentLines=autogenerated",
918
"prelint": "npm run lint:docs",
@@ -29,6 +38,7 @@
2938
"array.prototype.flatmap": "^1.3.0",
3039
"doctrine": "^2.1.0",
3140
"estraverse": "^5.3.0",
41+
"globals": "^13.17.0",
3242
"jsx-ast-utils": "^2.4.1 || ^3.0.0",
3343
"minimatch": "^3.1.2",
3444
"object.entries": "^1.1.5",

0 commit comments

Comments
 (0)