47.0.1 • Published 12 months ago

eslint-config-hardcore v47.0.1

Weekly downloads
870
License
MIT
Repository
github
Last release
12 months ago

eslint-config-hardcore

npm code style: prettier

The most strict (yet practical) ESLint config.

Aims to include as many plugins and rules as possible to make your code extremely consistent and robust.

53 plugins. 1341 rules.

Usage

npm install eslint-config-hardcore --save-dev

Available configs:

  • hardcore - base framework-agnostic config
  • hardcore/ts - additional config for TypeScript
  • hardcore/node- additional config for Node.js
  • hardcore/react - additional config for React
  • hardcore/react-performance - additional React config with performance rules
  • hardcore/vue - additional config for Vue 3/Nuxt 3
  • hardcore/react-testing-library - additional config for React Testing Library
  • hardcore/jest - additional config for Jest
  • hardcore/fp - additional config for functional programming
  • hardcore/ts-for-js - additional config for linting JavaScript with typescript-eslint

Example .eslintrc.json for a React project:

{
  "root": true,

  "extends": [
    "hardcore",
    "hardcore/react",
    "hardcore/react-performance",
    "hardcore/react-testing-library",
    "hardcore/jest",
    "hardcore/fp"
  ],

  "env": {
    "browser": true
  },

  "overrides": [
    {
      "files": ["server/**/*.js"],

      "extends": ["hardcore/node"],

      "env": {
        "browser": false
      }
    }
  ]
}

Example .eslintrc.json for a TypeScript React project:

{
  "root": true,

  "extends": [
    "hardcore",
    "hardcore/react",
    "hardcore/react-performance",
    "hardcore/react-testing-library",
    "hardcore/jest",
    "hardcore/fp",
    "hardcore/ts"
  ],

  "parserOptions": {
    "project": true
  },

  "env": {
    "browser": true
  },

  "overrides": [
    {
      "files": ["server/**/*.ts"],

      "extends": ["hardcore/node"],

      "env": {
        "browser": false
      }
    }
  ]
}

Example .eslintrc.json for a Vue 3 project:

{
  "root": true,

  "extends": ["hardcore", "hardcore/vue"],

  "settings": {
    "import/resolver": {
      "alias": {
        "map": [["@", "./src/"]],
        "extensions": [".js", ".vue"]
      }
    }
  }
}

Example .eslintrc.json for a Nuxt 3 project:

{
  "root": true,

  "extends": ["hardcore", "hardcore/vue"],

  "settings": {
    "import/resolver": {
      "alias": {
        "map": [
          ["@", "./"],
          ["#imports", ".nuxt/imports.d.ts"]
        ],

        "extensions": [".js", ".vue"]
      }
    }
  }
}

Example .eslintrc.json for a TypeScript Vue 3 project (depending on project configuration, you might want to change "project": true to "project": "tsconfig.app.json"):

{
  "root": true,

  "extends": ["hardcore", "hardcore/ts", "hardcore/vue"],

  "parserOptions": {
    "project": true
  },

  "overrides": [
    {
      "files": [
        "vite.config.*",
        "vitest.config.*",
        "cypress.config.*",
        "playwright.config.*"
      ],

      "parserOptions": {
        "project": "tsconfig.node.json"
      }
    },

    {
      "files": ["src/**/__tests__/*"],

      "parserOptions": {
        "project": "tsconfig.vitest.json"
      }
    }
  ]
}

Example .eslintrc.json for a TypeScript Nuxt 3 project:

{
  "root": true,

  "extends": ["hardcore", "hardcore/ts", "hardcore/vue"],

  "parserOptions": {
    "project": true
  }
}

Configs

hardcore

Base framework-agnostic config.

PluginEnabled rules
ESLint core rules173
eslint-plugin-unicorn103
eslint-plugin-regexp80
eslint-plugin-putout76
eslint-plugin-sonar51
eslint-plugin-import33
eslint-plugin-sonarjs31
HTML ESLint22
eslint-plugin-promise13
eslint-plugin-security12
eslint-plugin-perfectionist7
@stylistic/eslint-plugin7
eslint-plugin-eslint-comments6
eslint-plugin-sdl5
eslint-plugin-array-func3
eslint-plugin-unused-imports2
eslint-plugin-simple-import-sort2
eslint-plugin-no-constructor-bind1
eslint-plugin-no-unsanitized2
eslint-plugin-no-use-extend-native1
eslint-plugin-ext1
eslint-plugin-no-only-tests1
eslint-plugin-compat1
eslint-plugin-json¹1
eslint-plugin-yml¹1
eslint-plugin-toml¹1
Total:645

¹ json/yml/toml plugins actually include several rules, but I consider each plugin as a single "no-invalid" rule.

hardcore/ts

Config for TypeScript.

PluginEnabled rules
typescript-eslint105
eslint-plugin-etc10
eslint-plugin-total-functions8
@shopify/eslint-plugin3
eslint-plugin-sonar1
eslint-plugin-sort-class-members1
eslint-plugin-decorator-position1
eslint-plugin-no-explicit-type-exports1
eslint-plugin-typescript-compat1
Total:131

hardcore/node

Config for Node.js.

PluginEnabled rules
eslint-plugin-sonar53
eslint-plugin-n34
eslint-plugin-sdl1
Total:88

hardcore/react

Config for React.

PluginEnabled rules
eslint-plugin-react74
eslint-plugin-styled-components-a11y33
eslint-plugin-jsx-a11y34
eslint-plugin-storybook14
eslint-plugin-react-form-fields4
eslint-plugin-ssr-friendly4
@shopify/eslint-plugin3
eslint-plugin-react-hook-form3
eslint-plugin-react-hooks2
eslint-plugin-sonar2
eslint-plugin-validate-jsx-nesting1
eslint-plugin-react-prefer-function-component1
Total:175

hardcore/react-performance

Config with performance rules for React.

PluginEnabled rules
eslint-plugin-react4
eslint-plugin-react-perf4
eslint-plugin-react-usememo1
Total:9

hardcore/vue

Config for Vue 3/Nuxt 3.

PluginEnabled rules
eslint-plugin-vue168
eslint-plugin-vuejs-accessibility20
eslint-plugin-vue-scoped-css12
eslint-plugin-sonar1
Total:201

hardcore/react-testing-library

Config for React Testing Library.

PluginEnabled rules
eslint-plugin-testing-library24
Total:24

hardcore/jest

Config for Jest.

PluginEnabled rules
eslint-plugin-jest50
eslint-plugin-jest-dom11
eslint-plugin-jest-formatting7
Total:68

hardcore/fp

Config for functional programming.

PluginEnabled rules
eslint-plugin-functional9
Total:9

hardcore/ts-for-js

Config for linting JavaScript with typescript-eslint.

PluginEnabled rules
typescript-eslint28
eslint-plugin-etc4
@shopify/eslint-plugin2
eslint-plugin-sort-class-members1
eslint-plugin-decorator-position1
eslint-plugin-typescript-compat1
Total:37

Did you know you can lint JavaScript code with typescript-eslint?

Use this config to take advantage of typescript-eslint's advanced type-aware rules (like @typescript-eslint/naming-convention and @typescript-eslint/prefer-optional-chain) without the need to switch to writing TypeScript.

  1. First, you'll need to create tsconfig.json in the root of your project. You don't have to specify any options, just {} should do it.
  2. Then add hardcore/ts-for-js to the overrides section in your .eslintrc like this:
{
  "extends": ["hardcore"],

  "env": {
    "browser": true
  },

  "overrides": [
    {
      "files": ["*.js"],
      "extends": ["hardcore/ts-for-js"],
      "parserOptions": {
        "project": true
      }
    }
  ]
}

Changelog

License

MIT

@arthurgeron/eslint-plugin-react-usememo@html-eslint/eslint-plugin@html-eslint/parser@microsoft/eslint-plugin-sdl@putout/plugin-apply-shorthand-properties@shopify/eslint-plugin@stylistic/eslint-plugin@typescript-eslint/eslint-plugin@typescript-eslint/parsereslint-config-prettiereslint-import-resolver-aliaseslint-import-resolver-typescripteslint-plugin-array-funceslint-plugin-compateslint-plugin-decorator-positioneslint-plugin-eslint-commentseslint-plugin-etceslint-plugin-exteslint-plugin-functionaleslint-plugin-importeslint-plugin-jesteslint-plugin-jest-domeslint-plugin-jest-formattingeslint-plugin-jsoneslint-plugin-jsx-a11yeslint-plugin-neslint-plugin-no-constructor-bindeslint-plugin-no-explicit-type-exportseslint-plugin-no-only-testseslint-plugin-no-unsanitizedeslint-plugin-no-use-extend-nativeeslint-plugin-perfectionisteslint-plugin-promiseeslint-plugin-putouteslint-plugin-reacteslint-plugin-react-form-fieldseslint-plugin-react-hook-formeslint-plugin-react-hookseslint-plugin-react-perfeslint-plugin-react-prefer-function-componenteslint-plugin-regexpeslint-plugin-securityeslint-plugin-simple-import-sorteslint-plugin-sonareslint-plugin-sonarjseslint-plugin-sort-class-memberseslint-plugin-ssr-friendlyeslint-plugin-storybookeslint-plugin-styled-components-a11yeslint-plugin-testing-libraryeslint-plugin-tomleslint-plugin-total-functionseslint-plugin-typescript-compateslint-plugin-unicorneslint-plugin-unused-importseslint-plugin-validate-jsx-nestingeslint-plugin-vueeslint-plugin-vue-scoped-csseslint-plugin-vuejs-accessibilityeslint-plugin-ymlputout
47.0.0

12 months ago

47.0.1

12 months ago

46.1.0

12 months ago

46.0.0

1 year ago

45.7.0

1 year ago

45.8.0

1 year ago

45.5.0

1 year ago

45.6.0

1 year ago

45.4.0

1 year ago

45.3.0

1 year ago

45.2.0

1 year ago

45.1.1

1 year ago

45.1.0

2 years ago

43.0.0

2 years ago

42.0.0

2 years ago

45.0.0

2 years ago

44.0.0

2 years ago

41.3.0

2 years ago

41.2.0

2 years ago

37.0.0

2 years ago

41.1.0

2 years ago

36.4.0

2 years ago

40.0.0

2 years ago

38.0.0

2 years ago

41.0.0

2 years ago

40.1.0

2 years ago

39.0.3

2 years ago

39.0.2

2 years ago

39.0.1

2 years ago

39.0.0

2 years ago

36.0.1

2 years ago

36.1.0

2 years ago

36.1.1

2 years ago

36.2.0

2 years ago

36.3.0

2 years ago

36.3.1

2 years ago

36.3.2

2 years ago

36.0.0

2 years ago

35.2.0

2 years ago

35.2.1

2 years ago

35.2.2

2 years ago

35.2.3

2 years ago

35.2.4

2 years ago

35.3.0

2 years ago

35.3.1

2 years ago

35.4.0

2 years ago

35.5.0

2 years ago

35.6.0

2 years ago

35.7.0

2 years ago

35.7.1

2 years ago

35.8.0

2 years ago

31.0.0

2 years ago

29.0.0

2 years ago

30.0.0

2 years ago

34.0.0

2 years ago

32.2.0

2 years ago

27.0.0

2 years ago

33.0.0

2 years ago

32.1.0

2 years ago

35.0.0

2 years ago

35.0.1

2 years ago

32.0.0

2 years ago

28.0.0

2 years ago

35.1.0

2 years ago

25.1.0

3 years ago

26.0.1

2 years ago

26.0.0

3 years ago

25.2.0

3 years ago

25.0.0

3 years ago

24.15.0

3 years ago

24.14.0

3 years ago

24.13.1

3 years ago

24.13.0

3 years ago

24.12.0

3 years ago

24.7.0

3 years ago

24.6.0

3 years ago

24.11.0

3 years ago

24.9.0

3 years ago

24.10.0

3 years ago

24.8.1

3 years ago

24.8.0

3 years ago

24.5.0

3 years ago

24.4.0

3 years ago

23.4.0

4 years ago

23.8.0

3 years ago

24.3.0

3 years ago

23.5.0

4 years ago

23.9.0

3 years ago

24.2.0

3 years ago

23.6.0

3 years ago

23.6.2

3 years ago

23.6.1

3 years ago

24.1.0

3 years ago

23.7.0

3 years ago

24.0.0

3 years ago

23.1.0

4 years ago

23.2.0

4 years ago

23.3.1

4 years ago

23.3.0

4 years ago

23.0.0

4 years ago

22.2.0

4 years ago

22.1.0

4 years ago

22.0.0

4 years ago

21.0.0

4 years ago

20.5.0

4 years ago

20.4.0

4 years ago

20.3.0

4 years ago

20.2.0

4 years ago

20.1.0

4 years ago

20.0.0

4 years ago

20.0.0-alpha.8

4 years ago

20.0.0-alpha.7

4 years ago

20.0.0-alpha.9

4 years ago

20.0.0-alpha.4

4 years ago

20.0.0-alpha.6

4 years ago

20.0.0-alpha.5

4 years ago

20.0.0-alpha.0

4 years ago

20.0.0-alpha.2

4 years ago

20.0.0-alpha.1

4 years ago

20.0.0-alpha.3

4 years ago

19.19.4

4 years ago

19.19.3

4 years ago

19.18.0

4 years ago

19.18.1

4 years ago

19.17.0

4 years ago

19.19.2

4 years ago

19.19.1

4 years ago

19.19.0

4 years ago

19.16.0

4 years ago

19.15.2

4 years ago

19.15.1

4 years ago

19.14.0

4 years ago

19.13.0

4 years ago

19.15.0

4 years ago

19.12.0

4 years ago

19.11.0

4 years ago

19.10.1

4 years ago

19.10.0

4 years ago

19.9.0

4 years ago

19.8.0

4 years ago

19.7.0

4 years ago

19.6.1

4 years ago

19.6.0

4 years ago

19.6.2

4 years ago

19.5.0

4 years ago

19.0.0

4 years ago

19.4.0

4 years ago

19.3.0

4 years ago

18.1.0

4 years ago

19.2.0

4 years ago

18.0.1

4 years ago

18.0.0

4 years ago

19.1.0

4 years ago

17.4.0

4 years ago

17.3.0

4 years ago

17.2.0

4 years ago

17.1.0

4 years ago

17.0.0

4 years ago

16.8.0

4 years ago

16.7.1

4 years ago

16.5.0

4 years ago

16.6.0

4 years ago

16.7.0

4 years ago

16.3.0

4 years ago

16.4.0

4 years ago

16.2.0

4 years ago

16.1.0

4 years ago

16.0.2

4 years ago

16.0.1

4 years ago

16.0.0

4 years ago

15.3.0

4 years ago

15.2.0

4 years ago

15.1.0

4 years ago

15.0.0

4 years ago

14.0.0

5 years ago

13.2.0

5 years ago

13.1.1

5 years ago

13.1.0

5 years ago

13.0.0

5 years ago

12.9.1

5 years ago

12.9.0

5 years ago

12.8.0

5 years ago

12.8.1

5 years ago

12.7.0

5 years ago

12.6.0

5 years ago

12.5.0

5 years ago

12.4.0

5 years ago

12.3.0

5 years ago

12.2.0

5 years ago

12.0.0

5 years ago

12.1.0

5 years ago

12.1.1

5 years ago

11.2.0

5 years ago

11.1.0

5 years ago

11.0.0

5 years ago

10.3.0

5 years ago

10.2.0

5 years ago

10.1.0

5 years ago

10.0.0

5 years ago

9.0.0

5 years ago

8.1.0

5 years ago

8.0.4

6 years ago

8.0.3

6 years ago

8.0.2

6 years ago

7.6.1

6 years ago

7.6.0

6 years ago

7.4.0

6 years ago

7.5.0

6 years ago

8.0.1

6 years ago

8.0.0

6 years ago

7.3.0

6 years ago

7.2.0

6 years ago

7.1.0

6 years ago

7.0.0

6 years ago

6.5.0

6 years ago

6.4.0

6 years ago

6.3.0

6 years ago

6.2.0

6 years ago

6.1.0

6 years ago

6.0.0

6 years ago

5.6.0

6 years ago

5.5.0

6 years ago

5.4.1

6 years ago

5.4.0

6 years ago

5.3.1

6 years ago

5.3.0

6 years ago

5.2.0

6 years ago

5.1.0

7 years ago

5.0.2

7 years ago

5.0.1

7 years ago

5.0.0

7 years ago

4.1.0

7 years ago

4.0.1

7 years ago

4.0.0

7 years ago

3.6.0

7 years ago

3.5.0

8 years ago

3.4.0

8 years ago

3.3.0

8 years ago

3.2.0

8 years ago

3.1.1

8 years ago

3.1.0

8 years ago

3.0.0

8 years ago

2.2.0

8 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.13.0

8 years ago

1.12.0

8 years ago

1.11.0

8 years ago

1.10.0

8 years ago

1.9.0

8 years ago

1.8.0

8 years ago

1.7.1

8 years ago

1.7.0

8 years ago

1.6.0

9 years ago

1.5.1

9 years ago

1.5.0

9 years ago

1.4.0

9 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago