Skip to content

nonoroazoro/eslint-config-zoro

Repository files navigation

Zoro's ESLint Configuration

A fully customized ESLint configuration based on ESLint, Stylistic, TypeScript, React and Node rules.

GitHub License NPM Downloads

Installation

npm i -D eslint-config-zoro

Configurations

This package exports 5 different configuration files, allowing you to combine them freely to meet your needs.

  1. ESLint Configs: Consists of the ESLint rules, based on ESLint rules.
  2. Stylistic Configs: Consists of the Stylistic rules, based on Stylistic rules.
  3. TypeScript Configs: Consists of the TypeScript rules, based on TypeScript rules.
  4. React Configs: Consists of the React rules, based on React rules and React Hooks rules.
  5. Node Configs: Consists of the Node rules, based on Node rules.

How to configure?

Since the eslintrc format is deprecated from ESLint v9.0.0 and will be completely removed in v10.0.0, you should use eslint.config.js to configure ESLint.

See ESLint Configuration Migration Guide.

After migration, you can easily import and configure settings in your eslint.config.js file:

// eslint.config.js
import { ESLINT_CONFIGS } from "eslint-config-zoro/eslint";

export default [
  ...ESLINT_CONFIGS,
  {
    rules: {
        // Add your custom configurations here.
      "@stylistic/brace-style": ["error", "1tbs", { "allowSingleLine": true }],
      "@stylistic/indent-binary-ops": ["error", 2],
      "@stylistic/indent": ["error", 2, { "SwitchCase": 1 }]
    }
  }
];

You can also customize by combining configuration files as needed, such as:

import { ESLINT_CONFIGS } from "eslint-config-zoro/eslint";
import { STYLISTIC_CONFIGS } from "eslint-config-zoro/stylistic";
import { TYPESCRIPT_CONFIGS } from "eslint-config-zoro/typescript";

export default [
  ...ESLINT_CONFIGS,
  ...STYLISTIC_CONFIGS,
  ...TYPESCRIPT_CONFIGS
];

1. eslint-config-zoro/eslint

This configuration only contains the ESLint rules.

  1. Install:

    npm i -D eslint-config-zoro eslint
  2. Add to your eslint.config.js file:

    // eslint.config.js
    import { ESLINT_CONFIGS } from "eslint-config-zoro/eslint";
    
    export default [...ESLINT_CONFIGS];

2. eslint-config-zoro/stylistic

This configuration only contains the Stylistic rules.

  1. Install:

    npm i -D eslint-config-zoro eslint @stylistic/eslint-plugin
  2. Add to your eslint.config.js file:

    // eslint.config.js
    import { STYLISTIC_CONFIGS } from "eslint-config-zoro/stylistic";
    
    export default [...STYLISTIC_CONFIGS];

3. eslint-config-zoro/typescript

This configuration only contains the TypeScript rules.

  1. Install:

    npm i -D eslint-config-zoro eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
  2. Add to your eslint.config.js file:

    // eslint.config.js
    import { TYPESCRIPT_CONFIGS } from "eslint-config-zoro/typescript";
    
    export default [...TYPESCRIPT_CONFIGS];

4. eslint-config-zoro/react

This configuration only contains the React rules.

  1. Install:

    npm i -D eslint-config-zoro eslint eslint-plugin-react eslint-plugin-react-hooks
  2. Add to your eslint.config.js file:

    // eslint.config.js
    import { REACT_CONFIGS } from "eslint-config-zoro/react";
    
    export default [...REACT_CONFIGS];

5. eslint-config-zoro/node

This configuration only contains the Node rules.

  1. Install:

    npm i -D eslint-config-zoro eslint eslint-plugin-n
  2. Add to your eslint.config.js file:

    // eslint.config.js
    import { NODE_CONFIGS } from "eslint-config-zoro/node";
    
    export default [...NODE_CONFIGS];

Where to ask for help?

About

ESLint Configuration with VERY STRICT RULES 💢, supporting vanilla JavaScript and Typescript.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published