Skip to content

Commit

Permalink
feat: support new config system
Browse files Browse the repository at this point in the history
  • Loading branch information
jjangga0214 committed Sep 10, 2022
1 parent 8c9ec8a commit a3f8f5b
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
7 changes: 7 additions & 0 deletions configs/all.mjs
@@ -0,0 +1,7 @@
import recommended from './recommended.mjs'
import legacy from '../index.js'

export default {
...recommended,
rules: legacy.configs.all.rules
};
9 changes: 9 additions & 0 deletions configs/jsx-runtime.mjs
@@ -0,0 +1,9 @@
import recommended from './recommended.mjs'

export default {
...recommended,
rules: {
'react/react-in-jsx-scope': 0,
'react/jsx-uses-react': 0,
},
};
22 changes: 22 additions & 0 deletions configs/recommended.mjs
@@ -0,0 +1,22 @@
import react from '../index.mjs'
import legacy from '../index.js'
import globals from 'globals'

export default {
files: ['**/*.{js,jsx,ts,tsx}'],
globals: {
...globals.browser,
...globals.serviceworker
},
plugins: {
react
},
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
}
},
},
rules: legacy.configs.recommended.rules
};
5 changes: 5 additions & 0 deletions index.mjs
@@ -0,0 +1,5 @@
import { deprecatedRules, rules } from './index.js'

export default {
deprecatedRules, rules
}
10 changes: 10 additions & 0 deletions package.json
Expand Up @@ -4,6 +4,15 @@
"author": "Yannick Croissant <yannick.croissant+npm@gmail.com>",
"description": "React specific linting rules for ESLint",
"main": "index.js",
"exports": {
".": {
"import": "./index.mjs",
"require": "./index.js"
},
"./all": "./configs/all.mjs",
"./jsx-runtime": "./configs/jsx-runtime.mjs",
"./recommended": "./configs/recommended.mjs"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prelint": "npm run lint:docs",
Expand All @@ -29,6 +38,7 @@
"array.prototype.flatmap": "^1.3.0",
"doctrine": "^2.1.0",
"estraverse": "^5.3.0",
"globals": "^13.17.0",
"jsx-ast-utils": "^2.4.1 || ^3.0.0",
"minimatch": "^3.1.2",
"object.entries": "^1.1.5",
Expand Down

0 comments on commit a3f8f5b

Please sign in to comment.