eslint-config-react-app 4.0.0-next.b0cbf2ca → 5.0.1

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 (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +55 -46
  3. package/package.json +13 -8
package/README.md CHANGED
@@ -19,7 +19,7 @@ If you want to use this ESLint configuration in a project not built with Create
19
19
  First, install this package, ESLint and the necessary plugins.
20
20
 
21
21
  ```sh
22
- npm install --save-dev eslint-config-react-app babel-eslint@9.x eslint@5.x eslint-plugin-flowtype@2.x eslint-plugin-import@2.x eslint-plugin-jsx-a11y@6.x eslint-plugin-react@7.x eslint-plugin-react-hooks@1.5.0
22
+ npm install --save-dev eslint-config-react-app @typescript-eslint/eslint-plugin@1.x @typescript-eslint/parser@1.x babel-eslint@10.x eslint@6.x eslint-plugin-flowtype@3.x eslint-plugin-import@2.x eslint-plugin-jsx-a11y@6.x eslint-plugin-react@7.x eslint-plugin-react-hooks@1.x
23
23
  ```
24
24
 
25
25
  Then create a file named `.eslintrc.json` with following contents in the root folder of your project:
package/index.js CHANGED
@@ -23,16 +23,6 @@
23
23
  // To use them, explicitly reference them, e.g. `window.name` or `window.status`.
24
24
  const restrictedGlobals = require('confusing-browser-globals');
25
25
 
26
- // The following is copied from `react-scripts/config/paths.js`.
27
- const path = require('path');
28
- const fs = require('fs');
29
- // Make sure any symlinks in the project folder are resolved:
30
- // https://github.com/facebook/create-react-app/issues/637
31
- const appDirectory = fs.realpathSync(process.cwd());
32
- const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
33
- const projectRootPath = resolveApp('.');
34
- const tsConfigPath = resolveApp('tsconfig.json');
35
-
36
26
  module.exports = {
37
27
  root: true,
38
28
 
@@ -62,42 +52,59 @@ module.exports = {
62
52
  },
63
53
  },
64
54
 
65
- overrides: {
66
- files: ['**/*.ts', '**/*.tsx'],
67
- parser: '@typescript-eslint/parser',
68
- parserOptions: {
69
- ecmaVersion: 2018,
70
- sourceType: 'module',
71
- ecmaFeatures: {
72
- jsx: true,
73
- },
55
+ overrides: [
56
+ {
57
+ files: ['**/*.ts?(x)'],
58
+ parser: '@typescript-eslint/parser',
59
+ parserOptions: {
60
+ ecmaVersion: 2018,
61
+ sourceType: 'module',
62
+ ecmaFeatures: {
63
+ jsx: true,
64
+ },
74
65
 
75
- // typescript-eslint specific options
76
- project: tsConfigPath,
77
- tsconfigRootDir: projectRootPath,
78
- warnOnUnsupportedTypeScriptVersion: true,
79
- },
80
- plugins: ['@typescript-eslint'],
81
- rules: {
82
- // These ESLint rules are known to cause issues with typescript-eslint
83
- // See https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/recommended.json
84
- camelcase: 'off',
85
- indent: 'off',
86
- 'no-array-constructor': 'off',
87
- 'no-unused-vars': 'off',
66
+ // typescript-eslint specific options
67
+ warnOnUnsupportedTypeScriptVersion: true,
68
+ },
69
+ plugins: ['@typescript-eslint'],
70
+ // If adding a typescript-eslint version of an existing ESLint rule,
71
+ // make sure to disable the ESLint rule here.
72
+ rules: {
73
+ // TypeScript's `noFallthroughCasesInSwitch` option is more robust (#6906)
74
+ 'default-case': 'off',
75
+ // 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/291)
76
+ 'no-dupe-class-members': 'off',
77
+ // 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/477)
78
+ 'no-undef': 'off',
88
79
 
89
- '@typescript-eslint/no-angle-bracket-type-assertion': 'warn',
90
- '@typescript-eslint/no-array-constructor': 'warn',
91
- '@typescript-eslint/no-namespace': 'error',
92
- '@typescript-eslint/no-unused-vars': [
93
- 'warn',
94
- {
95
- args: 'none',
96
- ignoreRestSiblings: true,
97
- },
98
- ],
80
+ // Add TypeScript specific rules (and turn off ESLint equivalents)
81
+ '@typescript-eslint/no-angle-bracket-type-assertion': 'warn',
82
+ 'no-array-constructor': 'off',
83
+ '@typescript-eslint/no-array-constructor': 'warn',
84
+ '@typescript-eslint/no-namespace': 'error',
85
+ 'no-use-before-define': 'off',
86
+ '@typescript-eslint/no-use-before-define': [
87
+ 'warn',
88
+ {
89
+ functions: false,
90
+ classes: false,
91
+ variables: false,
92
+ typedefs: false,
93
+ },
94
+ ],
95
+ 'no-unused-vars': 'off',
96
+ '@typescript-eslint/no-unused-vars': [
97
+ 'warn',
98
+ {
99
+ args: 'none',
100
+ ignoreRestSiblings: true,
101
+ },
102
+ ],
103
+ 'no-useless-constructor': 'off',
104
+ '@typescript-eslint/no-useless-constructor': 'warn',
105
+ },
99
106
  },
100
- },
107
+ ],
101
108
 
102
109
  // NOTE: When adding rules here, you need to make sure they are compatible with
103
110
  // `typescript-eslint`, as some rules such as `no-array-constructor` aren't compatible.
@@ -156,7 +163,9 @@ module.exports = {
156
163
  'no-obj-calls': 'warn',
157
164
  'no-octal': 'warn',
158
165
  'no-octal-escape': 'warn',
159
- 'no-redeclare': 'warn',
166
+ // TODO: Remove this option in the next major release of CRA.
167
+ // https://eslint.org/docs/user-guide/migrating-to-6.0.0#-the-no-redeclare-rule-is-now-more-strict-by-default
168
+ 'no-redeclare': ['warn', { builtinGlobals: false }],
160
169
  'no-regex-spaces': 'warn',
161
170
  'no-restricted-syntax': ['warn', 'WithStatement'],
162
171
  'no-script-url': 'warn',
@@ -242,7 +251,7 @@ module.exports = {
242
251
  // https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules
243
252
  'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
244
253
  'react/jsx-no-comment-textnodes': 'warn',
245
- 'react/jsx-no-duplicate-props': ['warn', { ignoreCase: true }],
254
+ 'react/jsx-no-duplicate-props': 'warn',
246
255
  'react/jsx-no-target-blank': 'warn',
247
256
  'react/jsx-no-undef': 'error',
248
257
  'react/jsx-pascal-case': [
@@ -279,7 +288,7 @@ module.exports = {
279
288
  'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
280
289
  'jsx-a11y/aria-props': 'warn',
281
290
  'jsx-a11y/aria-proptypes': 'warn',
282
- 'jsx-a11y/aria-role': 'warn',
291
+ 'jsx-a11y/aria-role': ['warn', { ignoreNonDOM: true }],
283
292
  'jsx-a11y/aria-unsupported-elements': 'warn',
284
293
  'jsx-a11y/heading-has-content': 'warn',
285
294
  'jsx-a11y/iframe-has-title': 'warn',
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "eslint-config-react-app",
3
- "version": "4.0.0-next.b0cbf2ca",
3
+ "version": "5.0.1",
4
4
  "description": "ESLint configuration used by Create React App",
5
- "repository": "facebook/create-react-app",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/facebook/create-react-app.git",
8
+ "directory": "packages/eslint-config-react-app"
9
+ },
6
10
  "license": "MIT",
7
11
  "bugs": {
8
12
  "url": "https://github.com/facebook/create-react-app/issues"
@@ -13,15 +17,16 @@
13
17
  "peerDependencies": {
14
18
  "@typescript-eslint/eslint-plugin": "1.x",
15
19
  "@typescript-eslint/parser": "1.x",
16
- "babel-eslint": "9.x",
17
- "eslint": "5.x",
18
- "eslint-plugin-flowtype": "2.x",
20
+ "babel-eslint": "10.x",
21
+ "eslint": "6.x",
22
+ "eslint-plugin-flowtype": "3.x",
19
23
  "eslint-plugin-import": "2.x",
20
24
  "eslint-plugin-jsx-a11y": "6.x",
21
25
  "eslint-plugin-react": "7.x",
22
- "eslint-plugin-react-hooks": "1.5.0"
26
+ "eslint-plugin-react-hooks": "1.x"
23
27
  },
24
28
  "dependencies": {
25
- "confusing-browser-globals": "2.0.0-next.b0cbf2ca"
26
- }
29
+ "confusing-browser-globals": "^1.0.8"
30
+ },
31
+ "gitHead": "4410f5ec30783cc60360b6e2306b95eead56c015"
27
32
  }