docs: 📚️ add small documentation for each config
This commit is contained in:
@@ -5,7 +5,11 @@ import jsdocPlugin from 'eslint-plugin-jsdoc';
|
||||
import importPlugin from 'eslint-plugin-i';
|
||||
import process from 'node:process';
|
||||
|
||||
/** @type {import('eslint').Linter.FlatConfig} */
|
||||
/**
|
||||
* This config adds necessary plugins and configuration for ESLint to use in the other configs
|
||||
* **This should always be in the top of the configuration array**
|
||||
* @type {import('eslint').Linter.FlatConfig}
|
||||
*/
|
||||
const config = {
|
||||
files: [...tsFiles, ...jsFiles],
|
||||
languageOptions: {
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import perfectionistPlugin from 'eslint-plugin-perfectionist';
|
||||
import { jsFiles, tsFiles } from '../constants.js';
|
||||
|
||||
/** @type {import('eslint').Linter.FlatConfig} */
|
||||
/**
|
||||
* This config relates to code formatting and style in JavaScript and TypeScript
|
||||
* Recommended alternative, better for projects in prototyping phases.
|
||||
* @type {import('eslint').Linter.FlatConfig}
|
||||
*/
|
||||
const recommended = {
|
||||
files: [...tsFiles, ...jsFiles],
|
||||
plugins: {
|
||||
@@ -9,7 +13,7 @@ const recommended = {
|
||||
perfectionist: perfectionistPlugin,
|
||||
},
|
||||
rules: {
|
||||
|
||||
...{}, // ESLint rules
|
||||
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
|
||||
'comma-style': 'error',
|
||||
'curly': ['error', 'multi-or-nest', 'consistent'],
|
||||
@@ -28,7 +32,7 @@ const recommended = {
|
||||
}],
|
||||
'template-curly-spacing': ['error', 'never'],
|
||||
|
||||
...{}, // Typescript ESLint
|
||||
...{}, // Plugin: @typescript-eslint/eslint-plugin
|
||||
'@typescript-eslint/block-spacing': ['error', 'always'],
|
||||
'@typescript-eslint/brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
|
||||
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
|
||||
@@ -97,14 +101,14 @@ const recommended = {
|
||||
'space-before-function-paren': 'off',
|
||||
'space-infix-ops': 'off',
|
||||
|
||||
...{}, // Import plugin
|
||||
...{}, // Plugin: eslint-plugin-i (eslint-plugin-import)
|
||||
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
|
||||
'import/exports-last': 'error',
|
||||
'import/first': 'error',
|
||||
'import/group-exports': 'error',
|
||||
'import/newline-after-import': ['error', { considerComments: true }],
|
||||
|
||||
// Perfectionist plugin
|
||||
...{}, // Plugin: eslint-plugin-perfectionist
|
||||
...perfectionistPlugin.configs['recommended-natural'].rules,
|
||||
|
||||
'perfectionist/sort-exports': ['error', { type: 'line-length' }],
|
||||
@@ -113,7 +117,11 @@ const recommended = {
|
||||
},
|
||||
};
|
||||
|
||||
/** @type {import('eslint').Linter.FlatConfig} */
|
||||
/**
|
||||
* This config relates to code formatting and style in JavaScript and TypeScript
|
||||
* Strict alternative, better for projects in refactoring and/or production phases.
|
||||
* @type {import('eslint').Linter.FlatConfig}
|
||||
*/
|
||||
const strict = {
|
||||
...recommended,
|
||||
};
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/** @type {import('eslint').Linter.FlatConfig} */
|
||||
/**
|
||||
* This config relates to possible logic and syntax errors JavaScript and TypeScript
|
||||
* Recommended alternative, better for projects in prototyping phases.
|
||||
* @type {import('eslint').Linter.FlatConfig}
|
||||
*/
|
||||
const recommended = {
|
||||
rules: {
|
||||
...{}, // ESLint rules
|
||||
'constructor-super': 'error',
|
||||
'for-direction': 'error',
|
||||
'getter-return': 'error',
|
||||
@@ -52,7 +57,7 @@ const recommended = {
|
||||
'use-isnan': 'error',
|
||||
'valid-typeof': 'error',
|
||||
|
||||
...{}, // Plugin @typescript-eslint
|
||||
...{}, // Plugin: @typescript-eslint/eslint-plugin
|
||||
'@typescript-eslint/no-loss-of-precision': 'error',
|
||||
'@typescript-eslint/no-redeclare': 'error',
|
||||
'no-loss-of-precision': 'off',
|
||||
@@ -60,10 +65,15 @@ const recommended = {
|
||||
},
|
||||
};
|
||||
|
||||
/** @type {import('eslint').Linter.FlatConfig} */
|
||||
/**
|
||||
* This config relates to possible logic and syntax errors JavaScript and TypeScript
|
||||
* Strict alternative, better for projects in refactoring and/or production phases.
|
||||
* @type {import('eslint').Linter.FlatConfig}
|
||||
*/
|
||||
const strict = {
|
||||
...recommended,
|
||||
rules: {
|
||||
...{}, // ESLint rules
|
||||
'no-constant-binary-expression': 'error',
|
||||
'no-new-native-nonconstructor': 'error',
|
||||
'no-promise-executor-return': 'error',
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { jsFiles, tsFiles } from '../constants.js';
|
||||
|
||||
/** @type {import('eslint').Linter.FlatConfig} */
|
||||
/**
|
||||
* This config suggest alternate ways of doing things in JavaScript and TypeScript
|
||||
* Recommended alternative, better for projects in prototyping phases.
|
||||
* @type {import('eslint').Linter.FlatConfig}
|
||||
*/
|
||||
const recommended = {
|
||||
files: [...tsFiles, ...jsFiles],
|
||||
rules: {
|
||||
@@ -28,10 +32,16 @@ const recommended = {
|
||||
},
|
||||
};
|
||||
|
||||
/** @type {import('eslint').Linter.FlatConfig} */
|
||||
/**
|
||||
* This config suggest alternate ways of doing things in JavaScript and TypeScript
|
||||
* Strict alternative, better for projects in refactoring and/or production phases.
|
||||
* @type {import('eslint').Linter.FlatConfig}
|
||||
*/
|
||||
const strict = {
|
||||
...recommended,
|
||||
rules: {
|
||||
|
||||
...{}, // ESLint rules
|
||||
'accessor-pairs': 'error',
|
||||
'arrow-body-style': ['error', 'as-needed'],
|
||||
'block-scoped-var': 'error',
|
||||
@@ -105,7 +115,7 @@ const strict = {
|
||||
'symbol-description': 'error',
|
||||
'yoda': ['error', 'never'],
|
||||
|
||||
...{}, // Typescript rules
|
||||
...{}, // Plugin: @typescript-eslint/eslint-plugin
|
||||
'@typescript-eslint/class-methods-use-this': 'error',
|
||||
'@typescript-eslint/default-param-last': 'error',
|
||||
'@typescript-eslint/dot-notation': 'error',
|
||||
|
||||
Reference in New Issue
Block a user