3.2.1 • Published 3 months ago

@inrupt/eslint-config-react v3.2.1

Weekly downloads
349
License
MIT
Repository
github
Last release
3 months ago

eslint-config-inrupt-react

Eslint and prettier configs

Installation

  1. npm install --save-dev @inrupt/eslint-config-react @rushstack/eslint-patch

Setup (Quick start)

Create a .eslintrc.js in the the root of your project with the following contents:

require("@rushstack/eslint-patch/modern-module-resolution");

module.exports = {
  extends: ["@inrupt/eslint-config-react"],
  parserOptions: {
    project: "./tsconfig.eslint.json",
  },
  rules: {},
};

The file tsconfig.eslint.json is your typescript configuration with the e2e tests, unit tests and examples included, e.g.,

{
  "extends": "./tsconfig.json",
  "include": ["src/**/*.ts", "e2e/**/*.ts", "*.md"],
  "exclude": ["**/node_modules", "**/dist/**"]
}

For typescript projects:

require("@rushstack/eslint-patch/modern-module-resolution");

module.exports = {
  root: true,

  extends: [
    "@inrupt/eslint-config-react",
    "@inrupt/eslint-config-lib",
    "plugin:import/typescript",
  ],

  parserOptions: {
    project: "./tsconfig.eslint.json",
  },

  // These settings and the `plugin:import/typescript` are required until we add
  // this configuration to our @inrupt/eslint-config-lib base
  settings: {
    "import/parsers": {
      "@typescript-eslint/parser": [".ts", ".tsx"],
    },
    "import/resolver": {
      typescript: {
        alwaysTryTypes: true,
        project: "./tsconfig.eslint.json",
      },
    },
  },

  rules: {
    "react/jsx-filename-extension": [
      "error",
      {
        extensions: [".tsx"],
      },
    ],
  },
};

Migrating to this configuration:

  1. Add extends: ['@inrupt/eslint-config-react'] to your .eslintrc.js file.
  2. Add the following line to the top of the .eslintrc.js file:
require("@rushstack/eslint-patch/modern-module-resolution");

Rules

Exhaustive documentation forthcoming. For now, the general principles are:

  • Load a stylistic base set - in this case, airbnb and airbnb/hooks
  • Load inrupt-base, which loads recommended configs for common libraries: eslint, jest, typescript, and prettier
  • Do very little else- as few custom rules or overrides as possible.
  • Some rules are updated to work with nextjs.
3.2.1

3 months ago

3.2.0

3 months ago

3.1.0

3 months ago

3.0.2

5 months ago

3.0.1

5 months ago

3.0.0

5 months ago

2.6.0

5 months ago

2.4.1

8 months ago

2.4.0

8 months ago

2.0.4

10 months ago

2.3.0

8 months ago

2.1.2

9 months ago

2.1.1

10 months ago

2.5.0

7 months ago

2.1.3

9 months ago

2.1.0

10 months ago

2.0.3

11 months ago

2.0.2

11 months ago

2.0.1

11 months ago

1.8.0

12 months ago

1.7.0

1 year ago

2.0.0

11 months ago

1.6.2

1 year ago

1.6.1

1 year ago

1.6.0

1 year ago

1.5.5

1 year ago

1.5.4

1 year ago

1.5.3

1 year ago

1.5.2

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.2.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

1.0.0-alpha.6

2 years ago

1.0.1-alpha.0

2 years ago

1.0.0-alpha.5

2 years ago

1.0.0-alpha.4

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.3.0-alpha.2

2 years ago

0.3.0-alpha.1

2 years ago

0.2.0-alpha.1

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago