@open-turo/eslint-config-react 1.1.0 → 1.2.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.
@@ -8,7 +8,8 @@ jobs:
8
8
  name: Lint
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
- - uses: actions/checkout@v3
11
+ - name: Checkout
12
+ uses: actions/checkout@v3
12
13
  with:
13
14
  fetch-depth: 0
14
15
  - name: Download actionlint
@@ -9,10 +9,11 @@ jobs:
9
9
  release:
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
- - uses: actions/checkout@v2
12
+ - name: Checkout
13
+ uses: actions/checkout@v3
13
14
  with:
14
15
  fetch-depth: 0
15
- - name: Semantic Release
16
+ - name: Semantic release
16
17
  id: release
17
18
  uses: cycjimmy/semantic-release-action@v2
18
19
  with:
package/README.md CHANGED
@@ -13,6 +13,15 @@ repository extend the default `@open-turo/eslint-config-typescript` config inste
13
13
  free to create a PR to add a new default that extends it, and rename the current configurations to `legacy` and
14
14
  `legacy-extended` respectively. We are not doing that for now to reduce maintenance burden, as it would be unused.
15
15
 
16
+ [![Release](https://img.shields.io/github/v/release/open-turo/eslint-config-react)](https://github.com/open-turo/eslint-config-react/releases/)
17
+ [![Tests pass/fail](https://img.shields.io/github/workflow/status/open-turo/eslint-config-react/CI)](https://github.com/open-turo/eslint-config-react/actions/)
18
+ [![License](https://img.shields.io/github/license/open-turo/eslint-config-react)](./LICENSE)
19
+ [![Contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](https://github.com/dwyl/esta/issues)
20
+ ![CI](https://github.com/open-turo/eslint-config-react/actions/workflows/release.yaml/badge.svg)
21
+ [![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)
22
+ [![Conventional commits](https://img.shields.io/badge/conventional%20commits-1.0.2-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)
23
+ [![Join us!](https://img.shields.io/badge/Turo-Join%20us%21-593CFB.svg)](https://turo.com/jobs)
24
+
16
25
  ## Usage
17
26
 
18
27
  Install the package and all of its peer dependencies:
@@ -21,14 +30,8 @@ Install the package and all of its peer dependencies:
21
30
  npx install-peerdeps --dev @open-turo/eslint-config-react
22
31
  ```
23
32
 
24
- Then in your `.eslintrc` file extend from one of the two configurations included in this package:
25
-
26
- 1. The default, based on our existing front-end repositories
27
- 2. The "extended", which adds more react-related plugins. We intend to transition to this one as default over time
28
-
29
- ### Default config
30
-
31
- The default config of this repo is the recommended version for nour existing front-end projects.
33
+ Then in your `.eslintrc` file, extend from the default configuration of this package, which is the recommended eslint
34
+ configuration for our existing front-end projects.
32
35
 
33
36
  To use this config, just add to your `.eslintrc` the following:
34
37
 
@@ -36,18 +39,8 @@ To use this config, just add to your `.eslintrc` the following:
36
39
  "extends": "@open-turo/eslint-config-typescript"
37
40
  ```
38
41
 
39
- ### Extended config (extended react-related rules)
40
-
41
- We also provide an alternative `extended` preset, which adds more react-related plugins.
42
- We intend to transition to this one as default over time; and we encourage you to use it for new projects.
43
-
44
- If you want to use this `extended` configuration, you can import it by instead adding the following to your `.eslintrc`:
45
-
46
- ```
47
- "extends": "@open-turo/eslint-config-typescript/extended"
48
- ```
49
-
50
- Simply notice the `/extended` suffix, which points to the `extended.js` file in this repository.
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.
51
44
 
52
45
  ## Development
53
46
 
package/index.js CHANGED
@@ -1,11 +1,28 @@
1
1
  module.exports = {
2
2
  root: true,
3
+ plugins: ["react", "react-hooks", "jsx-a11y"],
3
4
  env: {
4
5
  browser: true,
5
6
  },
6
7
  ignorePatterns: ["babel.config.js"],
7
- extends: ["@open-turo/eslint-config-typescript/legacy"],
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
+ },
8
19
  rules: {
20
+ "jsx-a11y/anchor-is-valid": [
21
+ "warn",
22
+ {
23
+ specialLink: ["to"],
24
+ },
25
+ ],
9
26
  "node/no-unpublished-import": [
10
27
  "error",
11
28
  {
@@ -18,5 +35,25 @@ module.exports = {
18
35
  ],
19
36
  },
20
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
+ },
21
58
  },
22
59
  };
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "access": "public"
36
36
  },
37
37
  "repository": "https://github.com/open-turo/eslint-config-react",
38
- "version": "1.1.0"
38
+ "version": "1.2.0"
39
39
  }
package/extended.js DELETED
@@ -1,43 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- plugins: ["react", "react-hooks", "jsx-a11y"],
4
- extends: [
5
- "./index.js",
6
- "plugin:react/recommended",
7
- "plugin:react-hooks/recommended",
8
- "plugin:jsx-a11y/recommended",
9
- ],
10
- parserOptions: {
11
- ecmaFeatures: {
12
- jsx: true,
13
- },
14
- },
15
- rules: {
16
- "jsx-a11y/anchor-is-valid": [
17
- "warn",
18
- {
19
- specialLink: ["to"],
20
- },
21
- ],
22
- // don't force .jsx extension
23
- "react/jsx-filename-extension": "off",
24
- // In TS you must use the Fragment syntax instead of the shorthand
25
- "react/jsx-fragments": "off",
26
- // This allows props to be spread in JSX
27
- "react/jsx-props-no-spreading": "off",
28
- // ensure props are alphabetical
29
- "react/jsx-sort-props": "error",
30
- // We don't need default props on TS components
31
- "react/require-default-props": "off",
32
- "react/sort-prop-types": "error",
33
- // State initialization can be in the constructor or via class fields
34
- "react/state-in-constructor": "off",
35
- // This allows static properties to be placed within the class declaration
36
- "react/static-property-placement": "off",
37
- },
38
- settings: {
39
- react: {
40
- version: "detect",
41
- },
42
- },
43
- };