@tata-v/eslint-config-react-base 1.0.11 → 2.0.2

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 +145 -53
  2. package/package.json +18 -2
package/index.js CHANGED
@@ -1,55 +1,147 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- node: true,
5
- },
6
- rules: {
7
- 'no-var': 'warn',
8
- 'eqeqeq': 'warn',
9
- 'react/prop-types': 0,
10
- 'no-extra-semi': 'error',
11
- 'react/jsx-filename-extension': [2, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
12
- 'import/prefer-default-export': 'off',
13
- 'react-hooks/exhaustive-deps': 'off',
14
- 'react/jsx-pascal-case': 'warn',
15
- 'react/jsx-key': 'warn',
16
- 'no-debugger': 'off',
17
- 'react/function-component-definition': [2, { namedComponents: ['arrow-function', 'function-declaration'] }],
18
- 'react/react-in-jsx-scope': 0,
19
- 'react/prefer-stateless-function': 0,
20
- 'react/jsx-one-expression-per-line': 0,
21
- 'no-nested-ternary': 0,
22
- 'quotes': ['error', 'single'],
23
- 'arrow-parens': ['error', 'always'],
24
- 'no-console': 'warn',
25
- 'react/button-has-type': 'off',
26
- 'react/no-array-index-key': 'off',
27
- 'no-param-reassign': 'off',
28
- 'no-undef': 'off',
29
- '@typescript-eslint/no-explicit-any': 'off',
30
- 'semi': ['error', 'always'],
31
- 'react/jsx-no-useless-fragment': 'off',
32
- 'react/no-unused-prop-types': 'warn',
33
- '@typescript-eslint/no-unused-vars': 'warn',
34
- 'no-multiple-empty-lines': [ 'error', { max: 1 } ],
35
- 'object-curly-spacing': ['error', 'always'],
36
- 'react/react-in-jsx-scope': 'off',
37
- 'react/self-closing-comp': 'error',
38
- 'jsx-quotes': ['error', 'prefer-double'],
39
- 'space-infix-ops': ['error', { int32Hint: false }],
40
- 'comma-spacing': ['error', { before: false, after: true }],
41
- 'import/no-absolute-path': 'error',
42
- 'max-len': 'off',
43
- },
44
- settings: {
45
- react: {
46
- version: 'detect',
47
- },
48
- 'import/resolver': {
49
- node: {
50
- paths: ['src'],
51
- extensions: ['.js', '.jsx', '.ts', '.tsx'],
1
+ import js from "@eslint/js";
2
+ import { fixupPluginRules } from "@eslint/compat";
3
+
4
+ import react from "eslint-plugin-react";
5
+ import reactHooks from "eslint-plugin-react-hooks";
6
+ import importPlugin from "eslint-plugin-import";
7
+ import jsxA11y from "eslint-plugin-jsx-a11y";
8
+
9
+ export default function tataReactBase(options = {}) {
10
+ const {
11
+ files = ["**/*.{js,jsx,ts,tsx,mjs,cjs}"],
12
+ } = options;
13
+
14
+ return [
15
+ js.configs.recommended,
16
+
17
+ {
18
+ files,
19
+ plugins: {
20
+ react: fixupPluginRules(react),
21
+ "react-hooks": fixupPluginRules(reactHooks),
22
+ import: fixupPluginRules(importPlugin),
23
+ "jsx-a11y": fixupPluginRules(jsxA11y),
24
+ },
25
+ settings: {
26
+ react: { version: "detect" },
27
+ "import/resolver": {
28
+ node: {
29
+ paths: ["src"],
30
+ extensions: [".js", ".jsx", ".ts", ".tsx"],
31
+ },
32
+ },
52
33
  },
34
+ rules: {
35
+ // ----------------
36
+ // ESLint core
37
+ // ----------------
38
+ "no-var": "warn",
39
+ "eqeqeq": "warn",
40
+ "no-extra-semi": "error",
41
+ "no-restricted-imports": "off",
42
+ "no-empty": "off",
43
+ "no-unused-vars": "off",
44
+ "no-restricted-syntax": "off",
45
+ "no-prototype-builtins": "off",
46
+ "default-case": "off",
47
+ "no-restricted-globals": "off",
48
+ "no-mixed-operators": "off",
49
+ "no-underscore-dangle": "off",
50
+ "no-dupe-keys": "off",
51
+ "arrow-body-style": "off",
52
+ "linebreak-style": "off",
53
+ "no-use-before-define": "off",
54
+ "no-shadow": "off",
55
+ "no-alert": "off",
56
+ "object-curly-newline": "off",
57
+ "consistent-return": "off",
58
+ "no-tabs": "off",
59
+ "camelcase": "off",
60
+ "dot-notation": "off",
61
+ "no-redeclare": "off",
62
+ "prefer-destructuring": "off",
63
+ "no-unsafe-optional-chaining": "off",
64
+ "func-names": "off",
65
+ "no-multi-assign": "off",
66
+ "no-plusplus": "off",
67
+ "no-return-assign": "off",
68
+ "eol-last": "off",
69
+ "quote-props": "off",
70
+ "class-methods-use-this": "off",
71
+ "no-debugger": "off",
72
+ "no-undef": "off",
73
+ "no-param-reassign": "off",
74
+ "no-nested-ternary": "off",
75
+ "max-len": "off",
76
+
77
+ // formatting
78
+ "quotes": ["error", "single"],
79
+ "arrow-parens": ["error", "always"],
80
+ "semi": ["error", "always"],
81
+ "no-multiple-empty-lines": ["error", { max: 1 }],
82
+ "object-curly-spacing": ["error", "always"],
83
+ "jsx-quotes": ["error", "prefer-double"],
84
+ "space-infix-ops": ["error", { int32Hint: false }],
85
+ "comma-spacing": ["error", { before: false, after: true }],
86
+
87
+ // ----------------
88
+ // React
89
+ // ----------------
90
+ "react/prop-types": "off",
91
+ "react/jsx-filename-extension": ["error", { extensions: [".js", ".jsx", ".ts", ".tsx"] }],
92
+ "react/jsx-indent": "off",
93
+ "react/jsx-indent-props": "off",
94
+ "react/jsx-pascal-case": "warn",
95
+ "react/jsx-key": "warn",
96
+ "react/function-component-definition": ["error", { namedComponents: ["arrow-function", "function-declaration"] }],
97
+ "react/react-in-jsx-scope": "off",
98
+ "react/prefer-stateless-function": "off",
99
+ "react/jsx-one-expression-per-line": "off",
100
+ "react/button-has-type": "off",
101
+ "react/no-array-index-key": "off",
102
+ "react/jsx-no-useless-fragment": "off",
103
+ "react/no-unused-prop-types": "off",
104
+ "react/self-closing-comp": "error",
105
+ "react/display-name": "off",
106
+ "react/no-danger": "off",
107
+ "react/jsx-props-no-spreading": "off",
108
+ "react/require-default-props": "off",
109
+ "react/no-unknown-property": "off",
110
+ "react/destructuring-assignment": "off",
111
+ "react/sort-comp": "off",
112
+ "react/jsx-no-constructed-context-values": "off",
113
+ "react/no-unstable-nested-components": "off",
114
+ "react/no-unescaped-entities": "off",
115
+
116
+ // ----------------
117
+ // React Hooks
118
+ // ----------------
119
+ "react-hooks/exhaustive-deps": "off",
120
+ "react-hooks/rules-of-hooks": "off",
121
+
122
+ // ----------------
123
+ // Import
124
+ // ----------------
125
+ "import/prefer-default-export": "off",
126
+ "import/no-absolute-path": "error",
127
+ "import/no-named-as-default": "off",
128
+ "import/no-unresolved": "off",
129
+ "import/extensions": "off",
130
+ "import/no-extraneous-dependencies": "off",
131
+ "import/order": "off",
132
+ "import/export": "off",
133
+ "import/named": "off",
134
+
135
+ // ----------------
136
+ // JSX A11y
137
+ // ----------------
138
+ "jsx-a11y/alt-text": "off",
139
+ "jsx-a11y/no-noninteractive-element-interactions": "off",
140
+ "jsx-a11y/click-events-have-key-events": "off",
141
+ "jsx-a11y/no-static-element-interactions": "off",
142
+ "jsx-a11y/control-has-associated-label": "off",
143
+ "jsx-a11y/label-has-associated-control": "off",
144
+ }
53
145
  },
54
- },
55
- };
146
+ ];
147
+ }
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@tata-v/eslint-config-react-base",
3
- "version": "1.0.11",
3
+ "version": "2.0.2",
4
4
  "main": "index.js",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": "./index.js"
8
+ },
5
9
  "keywords": [],
6
10
  "author": {
7
11
  "name": "tata-v",
@@ -11,5 +15,17 @@
11
15
  "publishConfig": {
12
16
  "access": "public",
13
17
  "registry": "https://registry.npmjs.org/"
18
+ },
19
+ "peerDependencies": {
20
+ "eslint": "^10.0.0",
21
+ "@eslint/js": "^10.0.0",
22
+ "@eslint/compat": "^1.0.0",
23
+ "eslint-plugin-react": "^7.37.0",
24
+ "eslint-plugin-react-hooks": "^7.0.0",
25
+ "eslint-plugin-import": "^2.32.0",
26
+ "eslint-plugin-jsx-a11y": "^6.10.0"
27
+ },
28
+ "peerDependenciesMeta": {
29
+ "@eslint/compat": { "optional": true }
14
30
  }
15
- }
31
+ }