3.0.0 • Published 2 years ago

eslint-config-stratpoint v3.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

eslint-config-stratpoint

ESLint configs that support different environments and work with Prettier out of the box.

Supported environments

  • Node.js
  • React
  • TypeScript
  • Jest
  • Mocha
  • Next.js

Using the base config

Note: The other configs below already extend this base config, so there is no reason to extend it directly unless creating a custom config for a new environment.

Installation

npm install --save-dev eslint eslint-config-stratpoint

Configuration

Extend the config by adding it to your .eslintrc.* file or in the eslintConfig property of your package.json. For example, for a .eslintrc.js file:

module.exports = {
  extends: 'stratpoint',
};

Using the Node.js-specific config

Installation

npm install --save-dev eslint eslint-config-stratpoint

Configuration

Extend the config by adding it to your .eslintrc.* file or in the eslintConfig property of your package.json. For example, for a .eslintrc.yml file:

extends: 'stratpoint/nodejs'

Using the React-specific config

Installation

npm install --save-dev eslint eslint-config-stratpoint eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y eslint-plugin-import

Configuration

Extend the config by adding it to your .eslintrc.* file or in the eslintConfig property of your package.json. For example, for a .eslintrc.json file:

{
  "extends": "stratpoint/react"
}

Using the TypeScript-specific config

Installation

npm install --save-dev eslint eslint-config-stratpoint typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-import-resolver-typescript

Configuration

Extend the config by adding it to your .eslintrc.* file or in the eslintConfig property of your package.json. For example, for the eslintConfig property of a package.json:

{
  "eslintConfig": {
    "extends": "stratpoint/typescript"
  }
}

Using the Jest-specific config

Note: The Jest config should be extended in the overrides section of a config as suggested by eslint-plugin-jest's documentation:

The rules provided by this plugin assume that the files they are checking are test-related. This means it's generally not suitable to include them in your top-level configuration as that applies to all files being linted which can include source files.

Installation

npm install --save-dev eslint eslint-config-stratpoint eslint-plugin-jest eslint-plugin-jest-dom

Configuration

Extend the config by adding it to your .eslintrc.* file or in the eslintConfig property of your package.json. For example, for a .eslintrc.js file:

module.exports = {
  overrides: {
    files: ['test/**'],
    extends: 'stratpoint/jest',
  },
};

Using the Mocha-specific config

Installation

npm install --save-dev eslint eslint-config-stratpoint eslint-plugin-mocha

Configuration

Extend the config by adding it to your .eslintrc.* file or in the eslintConfig property of your package.json. For example, for a .eslintrc.yml file:

extends: 'stratpoint/mochajs'

Using the Next.js-specific config

Note: This config only includes rules specific to Next.js. To get other rules relevant to React and JSX, the React config should also be extended.

Installation

npm install --save-dev eslint eslint-config-stratpoint @next/eslint-plugin-next eslint-plugin-jsx-a11y

Configuration

Extend the config by adding it to your .eslintrc.* file or in the eslintConfig property of your package.json. For example, for a .eslintrc.json file:

{
  "extends": "stratpoint/next"
}

Using multiple configs

Note: When extending multiple configs together with the TypeScript config, it is important to put the TypeScript config last as it turns off built-in or plugin rules that may conflict with TypeScript which other configs may turn on.

To use multiple configs together, install all of the needed packages and extend them in your .eslintrc.* file or in the eslintConfig property of your package.json. For example, when using both React and TypeScript configs, install the depenencies of both:

npm install --save-dev eslint eslint-config-stratpoint eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-import-resolver-typescript

Then, extend them in your config. For example, in a .eslintrc.yml file:

extends:
  - 'stratpoint/react'
  - 'stratpoint/typescript'

Changelog

3.0.0 - September 16, 2022

  • TypeScript and React config
    • Add import rules
  • Add Next.js config with the following plugins
    • @next/eslint-plugin-next

2.0.0 - September 2, 2022

  • React config
    • Set version to detect
    • Integrate eslint-plugin-jsx-a11y and eslint-plugin-import
  • TypeScript config
    • Integrate eslint-plugin-import and eslint-import-resolver-typescript
    • Add rules
  • Add Jest config with the following plugins
    • eslint-plugin-jest
    • eslint-plugin-jest-dom
  • Add Mocha config with the following plugins
    • eslint-plugin-mocha

1.0.0 - August 17, 2022

  • Initial release