1.0.0 • Published 9 months ago

@lunit/eslint-config v1.0.0

Weekly downloads
10
License
MIT
Repository
github
Last release
9 months ago

@lunit/eslint-config

A TypeScript ESLint ruleset designed for lunit projects based on @rushstack/eslint-config.

Installation

npm install --save-dev @lunit/eslint-config

Usage

Referring to the sapmple-project folder, create eslint-config folder in the project repository root folder, add index.js file, and then extend the eslint-config folder to the .eslintrc.cjs file.

# Project folder structure
sample-project/
├── .eslintrc.cjs
└── eslint-config
    ├── index.js
    └── mixins
        └── react.js
// .eslintrc.cjs
module.exports = {
  ...
  extends: [
    './eslint-config', // Extend common ESLint config
  ],
  settings: {
    react: {
      // Specifies the current React version (e.g. version: '18.2')
      // If not specified (default 'detect'), the entire React library will be loaded,
      // which may slow down the linting process.
      version: 'detect',
    },
  },
  ...
};

If necessary, add your own mixin to the eslint-config/mixins folder and use it, or use the mixins in @rushstack/eslint-config/mixins. (Refer to eslint-config/index.js)

// eslint-config/index.js
module.exports = {
  ...
  extends: [
    // (required) Extend the @lunit/eslint-config.
    // (@rushstack/eslint-config/profile/web-app is included by default.)
    '@lunit/eslint-config',
    // React mixin provided by rushstack (requires installation of @rushstack/eslint-config package)
    // '@rushstack/eslint-config/mixins/react',
    // You can create and use your own mixin as follows.
    './mixins/react',
  ],
  ...
};

Refer to the default settings in @lunit/eslint-config/index.js & @rushstack/eslint-config/profile/web-app and add your own rules to the config if necessary. Any esconfig rule entries added must have a valid RATIONALE.

rules: {
  ...
  // RATIONALE : Enforce consistent function types for function components.
  'react/function-component-definition': 'error',
  ...
},
1.0.0

9 months ago

0.5.0

5 years ago

0.4.0

5 years ago

0.4.0-alpha.1

5 years ago

0.3.0

5 years ago

0.2.4

5 years ago

0.1.0

5 years ago