Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-config-hardcore

Package Overview
Dependencies
Maintainers
0
Versions
266
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-config-hardcore

The most strict (yet practical) ESLint config

  • 47.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

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

Keywords

FAQs

Package last updated on 26 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc