@open-turo/eslint-config-react 6.0.2 → 7.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.
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 20.11.1
1
+ 20.12.1
@@ -12,7 +12,7 @@ repos:
12
12
  - id: prettier
13
13
  stages: [commit]
14
14
  - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
15
- rev: v9.13.0
15
+ rev: v9.14.0
16
16
  hooks:
17
17
  - id: commitlint
18
18
  stages: [commit-msg]
package/README.md CHANGED
@@ -12,16 +12,6 @@ Turo eslint configuration for react. The config expects that Typescript is being
12
12
  [![Conventional commits](https://img.shields.io/badge/conventional%20commits-1.0.2-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)
13
13
  [![Join us!](https://img.shields.io/badge/Turo-Join%20us%21-593CFB.svg)](https://turo.com/jobs)
14
14
 
15
- ## Relevant notes
16
-
17
- The `eslint` configurations in this repo extend `@open-turo/eslint-config-typescript/legacy`; as it is the base TS
18
- eslint config that supports our existing front-end codebase.
19
-
20
- However, if you are creating a new React project and you think you would benefit from having the configurations in this
21
- repository extend the default `@open-turo/eslint-config-typescript` config instead, please raise an issue and/or feel
22
- free to create a PR to add a new default that extends it, and rename the current configurations to `legacy` and
23
- `legacy-extended` respectively. We are not doing that for now to reduce maintenance burden, as it would be unused.
24
-
25
15
  ## Usage
26
16
 
27
17
  Install the package and all of its peer dependencies:
@@ -39,8 +29,18 @@ To use this config, just add to your `.eslintrc` the following:
39
29
  "extends": "@open-turo/eslint-config-typescript"
40
30
  ```
41
31
 
42
- We used to have an alternative `extended` preset, which added more react-related plugins, but after some testing, it
43
- has been integrated into the default preset.
32
+ ### Legacy preset
33
+
34
+ There is a `legacy` preset that extends `@open-turo/eslint-config-typescript/legacy`. This only exists for backwards
35
+ compatibility with existing projects. It is strongly recommended to use the standard preset.
36
+
37
+ To use the `legacy` preset, update your `.eslintrc` file to be:
38
+
39
+ ```json
40
+ {
41
+ "extends": "@open-turo/eslint-config-react/legacy"
42
+ }
43
+ ```
44
44
 
45
45
  ## Development
46
46
 
@@ -0,0 +1,15 @@
1
+ # Breaking changes in v6
2
+
3
+ This preset now uses the standard config from `@open-turo/eslint-config-typescript`. There is now a `legacy` preset that
4
+ extends `@open-turo/eslint-config-typescript/legacy`.
5
+
6
+ ## Upgrade instructions
7
+
8
+ It is strongly recommended to use the standard preset. If you want to still use the previous configuration,
9
+ you can switch to the `legacy` preset by updating your `.eslintrc` file to be:
10
+
11
+ ```json
12
+ {
13
+ "extends": "@open-turo/eslint-config-react/legacy"
14
+ }
15
+ ```
package/index.js CHANGED
@@ -6,8 +6,9 @@ module.exports = {
6
6
  },
7
7
  ignorePatterns: ["babel.config.js"],
8
8
  extends: [
9
- "@open-turo/eslint-config-typescript/legacy",
9
+ "@open-turo/eslint-config-typescript",
10
10
  "plugin:react/recommended",
11
+ "plugin:react/jsx-runtime",
11
12
  "plugin:react-hooks/recommended",
12
13
  "plugin:jsx-a11y/recommended",
13
14
  ],
@@ -43,6 +44,8 @@ module.exports = {
43
44
  "react/jsx-props-no-spreading": "off",
44
45
  // ensure props are alphabetical
45
46
  "react/jsx-sort-props": "error",
47
+ // Allow emotion css prop
48
+ "react/no-unknown-property": ["error", { ignore: ["css"] }],
46
49
  // We don't need default props on TS components
47
50
  "react/require-default-props": "off",
48
51
  "react/sort-prop-types": "error",
@@ -50,6 +53,8 @@ module.exports = {
50
53
  "react/state-in-constructor": "off",
51
54
  // This allows static properties to be placed within the class declaration
52
55
  "react/static-property-placement": "off",
56
+ // Allow file names to match a component name
57
+ "unicorn/filename-case": "off",
53
58
  },
54
59
  settings: {
55
60
  react: {
package/legacy.js ADDED
@@ -0,0 +1,59 @@
1
+ module.exports = {
2
+ root: true,
3
+ plugins: ["react", "react-hooks", "jsx-a11y"],
4
+ env: {
5
+ browser: true,
6
+ },
7
+ ignorePatterns: ["babel.config.js"],
8
+ extends: [
9
+ "@open-turo/eslint-config-typescript/legacy",
10
+ "plugin:react/recommended",
11
+ "plugin:react-hooks/recommended",
12
+ "plugin:jsx-a11y/recommended",
13
+ ],
14
+ parserOptions: {
15
+ ecmaFeatures: {
16
+ jsx: true,
17
+ },
18
+ },
19
+ rules: {
20
+ "jsx-a11y/anchor-is-valid": [
21
+ "warn",
22
+ {
23
+ specialLink: ["to"],
24
+ },
25
+ ],
26
+ "node/no-unpublished-import": [
27
+ "error",
28
+ {
29
+ allowModules: [
30
+ "@jest/globals",
31
+ "@testing-library/dom",
32
+ "@testing-library/react",
33
+ "@testing-library/user-event",
34
+ "nock",
35
+ ],
36
+ },
37
+ ],
38
+ // don't force .jsx extension
39
+ "react/jsx-filename-extension": "off",
40
+ // In TS you must use the Fragment syntax instead of the shorthand
41
+ "react/jsx-fragments": "off",
42
+ // This allows props to be spread in JSX
43
+ "react/jsx-props-no-spreading": "off",
44
+ // ensure props are alphabetical
45
+ "react/jsx-sort-props": "error",
46
+ // We don't need default props on TS components
47
+ "react/require-default-props": "off",
48
+ "react/sort-prop-types": "error",
49
+ // State initialization can be in the constructor or via class fields
50
+ "react/state-in-constructor": "off",
51
+ // This allows static properties to be placed within the class declaration
52
+ "react/static-property-placement": "off",
53
+ },
54
+ settings: {
55
+ react: {
56
+ version: "detect",
57
+ },
58
+ },
59
+ };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Turo engineering",
3
3
  "description": "Turo eslint configuration for react",
4
4
  "dependencies": {
5
- "@open-turo/eslint-config-typescript": "8.0.2",
5
+ "@open-turo/eslint-config-typescript": "8.0.3",
6
6
  "eslint-plugin-jsx-a11y": "6.8.0",
7
7
  "eslint-plugin-json": "3.1.0",
8
8
  "eslint-plugin-react": "7.34.1",
@@ -32,5 +32,5 @@
32
32
  "access": "public"
33
33
  },
34
34
  "repository": "https://github.com/open-turo/eslint-config-react",
35
- "version": "6.0.2"
35
+ "version": "7.0.0"
36
36
  }