@empjs/eslint-config-react 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +72 -0
  2. package/package.json +31 -0
package/index.js ADDED
@@ -0,0 +1,72 @@
1
+ module.exports = {
2
+ parser: '@typescript-eslint/parser',
3
+ extends: [
4
+ 'plugin:react/recommended',
5
+ 'plugin:react-hooks/recommended',
6
+ 'plugin:@typescript-eslint/recommended',
7
+ 'prettier',
8
+ 'plugin:prettier/recommended',
9
+ ], //使用推荐的React代码检测规范
10
+ plugins: [
11
+ '@typescript-eslint',
12
+ 'react-native',
13
+ // 'unused-imports'
14
+ ],
15
+ env: {
16
+ browser: true,
17
+ node: true,
18
+ },
19
+ settings: {
20
+ //自动发现React的版本,从而进行规范react代码
21
+ react: {
22
+ pragma: 'React',
23
+ // version: 'detect',
24
+ version: '999.999.999',
25
+ },
26
+ },
27
+ parserOptions: {
28
+ //指定ESLint可以解析JSX语法
29
+ ecmaVersion: 2020,
30
+ sourceType: 'module',
31
+ ecmaFeatures: {
32
+ jsx: true,
33
+ },
34
+ },
35
+ rules: {
36
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
37
+ '@typescript-eslint/no-var-requires': 0,
38
+ 'react/react-in-jsx-scope': 0,
39
+ '@typescript-eslint/explicit-function-return-type': 0,
40
+ '@typescript-eslint/no-empty-function': 0,
41
+ '@typescript-eslint/no-explicit-any': 0,
42
+ '@typescript-eslint/no-unused-vars': 0,
43
+ '@typescript-eslint/no-use-before-define': 0,
44
+ '@typescript-eslint/class-name-casing': 0,
45
+ '@typescript-eslint/triple-slash-reference': 0,
46
+ 'react-hooks/rules-of-hooks': 'warn',
47
+ 'react-hooks/exhaustive-deps': 'off',
48
+ 'prettier/prettier': [
49
+ 'error',
50
+ {
51
+ printWidth: 120,
52
+ semi: false,
53
+ singleQuote: true,
54
+ trailingComma: 'all',
55
+ bracketSpacing: false,
56
+ // jsxBracketSameLine: true,
57
+ arrowParens: 'avoid',
58
+ insertPragma: false,
59
+ tabWidth: 2,
60
+ useTabs: false,
61
+ endOfLine: 'auto',
62
+ },
63
+ ],
64
+ // nused-imports
65
+ // 'no-unused-vars': 'off', // or "@typescript-eslint/no-unused-vars": "off",
66
+ // 'unused-imports/no-unused-imports': 'error',
67
+ // 'unused-imports/no-unused-vars': [
68
+ // 'warn',
69
+ // {vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_'},
70
+ // ],
71
+ },
72
+ }
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@empjs/eslint-config-react",
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "maintainers": [
6
+ "ckken@qq.com"
7
+ ],
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/empjs/emp.git",
11
+ "directory": "packages/eslint-config-react"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "dependencies": {
17
+ "@typescript-eslint/eslint-plugin": "^6.7.5",
18
+ "@typescript-eslint/parser": "^6.7.5",
19
+ "eslint": "^8.51.0",
20
+ "eslint-config-prettier": "^9.0.0",
21
+ "eslint-plugin-prettier": "^5.0.1",
22
+ "eslint-plugin-react": "^7.33.2",
23
+ "eslint-plugin-react-hooks": "^4.6.0",
24
+ "eslint-plugin-react-native": "^4.1.0",
25
+ "eslint-plugin-unused-imports": "^3.0.0",
26
+ "prettier": "^3.0.3"
27
+ },
28
+ "devDependencies": {
29
+ "typescript": "^5.2.2"
30
+ }
31
+ }