@jabworks/eslint-plugin 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +74 -0
- package/package.json +60 -0
- package/src/configs/base.js +60 -0
- package/src/configs/comments.js +13 -0
- package/src/configs/next.js +86 -0
- package/src/configs/react.js +52 -0
- package/src/configs/typescript.js +30 -0
- package/src/configs/vitest.js +28 -0
- package/src/index.js +25 -0
- package/src/lib/constants.js +3 -0
- package/src/rules/best-practice.js +228 -0
- package/src/rules/comments.js +12 -0
- package/src/rules/es6.js +66 -0
- package/src/rules/import.js +116 -0
- package/src/rules/jsx-a11y.js +6 -0
- package/src/rules/possible-errors.js +35 -0
- package/src/rules/react.js +122 -0
- package/src/rules/stylistic.js +119 -0
- package/src/rules/typescript.extension.js +39 -0
- package/src/rules/typescript.import.js +19 -0
- package/src/rules/typescript.js +137 -0
- package/src/rules/unicorn.js +16 -0
- package/src/rules/variables.js +31 -0
- package/src/rules/vitest.js +10 -0
- package/src/types/index.d.ts +17 -0
- package/tsconfig.json +3 -0
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @jabworks/eslint-plugin
|
|
2
|
+
|
|
3
|
+
A custom ESLint plugin and shareable config for JavaScript, TypeScript, React, and Next.js projects. This package provides a set of curated rules and configurations to help enforce code quality, consistency, and best practices across your codebase.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Comprehensive rule sets** for JavaScript, TypeScript, React, and Next.js
|
|
8
|
+
- **Opinionated import sorting** with `simple-import-sort`
|
|
9
|
+
- **Best practices** and stylistic rules
|
|
10
|
+
- **Prettier integration** for code formatting
|
|
11
|
+
- **Support for modern ECMAScript features**
|
|
12
|
+
- **Flat config support** (ESLint v9+)
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add -D @jabworks/eslint-plugin
|
|
18
|
+
# or
|
|
19
|
+
yarn add -D @jabworks/eslint-plugin
|
|
20
|
+
# or
|
|
21
|
+
npm install --save-dev @jabworks/eslint-plugin
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
Add the plugin to your ESLint configuration. Example using the flat config format (recommended for ESLint v9+):
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
// eslint.config.js or eslint.config.mjs
|
|
30
|
+
import { plugin as jablabPlugin } from '@jabworks/eslint-plugin';
|
|
31
|
+
|
|
32
|
+
export default [
|
|
33
|
+
...jablabPlugin.configs.base,
|
|
34
|
+
// or for React/Next.js/TypeScript/Vitest:
|
|
35
|
+
// ...jablabPlugin.configs.react,
|
|
36
|
+
// ...jablabPlugin.configs.next,
|
|
37
|
+
// ...jablabPlugin.configs.typescript,
|
|
38
|
+
// ...jablabPlugin.configs.vitest,
|
|
39
|
+
];
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Or, if using legacy config:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"extends": ["plugin:@jabworks/base"]
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Available Configs
|
|
51
|
+
|
|
52
|
+
- `base` – General JavaScript/TypeScript rules
|
|
53
|
+
- `comments` – Rules for ESLint directive comments
|
|
54
|
+
- `react` – React-specific rules
|
|
55
|
+
- `next` – Next.js-specific rules
|
|
56
|
+
- `typescript` – TypeScript-specific rules
|
|
57
|
+
- `vitest` – Vitest-specific rules
|
|
58
|
+
|
|
59
|
+
## Example: Import Sorting
|
|
60
|
+
|
|
61
|
+
This plugin enforces a consistent import order using `simple-import-sort`. Example:
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
import React from 'react';
|
|
65
|
+
import express from 'express';
|
|
66
|
+
import lodash from 'lodash';
|
|
67
|
+
import myUtil from '@/utils/myUtil';
|
|
68
|
+
import helper from './helper';
|
|
69
|
+
import styles from './styles.css';
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Opinionated ESLint plugin and flat config for JS, TS, React, and Next.js",
|
|
3
|
+
"devDependencies": {
|
|
4
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
5
|
+
"@eslint/js": "^9.27.0",
|
|
6
|
+
"@next/eslint-plugin-next": "^15.3.2",
|
|
7
|
+
"@stylistic/eslint-plugin": "^4.4.0",
|
|
8
|
+
"@types/node": "^22.15.23",
|
|
9
|
+
"@vitest/eslint-plugin": "^1.2.1",
|
|
10
|
+
"eslint": "^9.27.0",
|
|
11
|
+
"eslint-config-prettier": "^10.1.5",
|
|
12
|
+
"eslint-import-resolver-alias": "^1.1.2",
|
|
13
|
+
"eslint-import-resolver-typescript": "^4.4.1",
|
|
14
|
+
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
15
|
+
"eslint-plugin-import": "^2.31.0",
|
|
16
|
+
"eslint-plugin-jest": "^28.11.1",
|
|
17
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
18
|
+
"eslint-plugin-playwright": "^2.2.0",
|
|
19
|
+
"eslint-plugin-react": "^7.37.5",
|
|
20
|
+
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
21
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
22
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
23
|
+
"eslint-plugin-testing-library": "^7.2.2",
|
|
24
|
+
"eslint-plugin-turbo": "^2.5.3",
|
|
25
|
+
"eslint-plugin-unicorn": "^59.0.1",
|
|
26
|
+
"globals": "^16.2.0",
|
|
27
|
+
"typescript": "^5.8.3",
|
|
28
|
+
"typescript-eslint": "^8.33.0",
|
|
29
|
+
"@jabworks/typescript-config": "0.0.0"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"import": "./src/index.js",
|
|
34
|
+
"types": "./src/types/index.d.ts"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"eslint",
|
|
39
|
+
"eslint-config",
|
|
40
|
+
"eslint-plugin",
|
|
41
|
+
"eslintplugin",
|
|
42
|
+
"typescript",
|
|
43
|
+
"typescript-eslint"
|
|
44
|
+
],
|
|
45
|
+
"main": "./src/index.js",
|
|
46
|
+
"name": "@jabworks/eslint-plugin",
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"eslint": ">=9.27.0",
|
|
49
|
+
"typescript": ">=5.8.0",
|
|
50
|
+
"typescript-eslint": ">=8.33.0"
|
|
51
|
+
},
|
|
52
|
+
"private": false,
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": ""
|
|
56
|
+
},
|
|
57
|
+
"type": "module",
|
|
58
|
+
"types": "./src/types/index.d.ts",
|
|
59
|
+
"version": "1.0.0"
|
|
60
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import eslintjs from '@eslint/js';
|
|
2
|
+
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
3
|
+
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
4
|
+
import importPlugin from 'eslint-plugin-import';
|
|
5
|
+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
|
|
6
|
+
import unicorn from 'eslint-plugin-unicorn';
|
|
7
|
+
import tseslint from 'typescript-eslint';
|
|
8
|
+
import bestPractice from '../rules/best-practice.js';
|
|
9
|
+
import es6 from '../rules/es6.js';
|
|
10
|
+
import importConfig from '../rules/import.js';
|
|
11
|
+
import possibleErrors from '../rules/possible-errors.js';
|
|
12
|
+
import stylistic from '../rules/stylistic.js';
|
|
13
|
+
import variables from '../rules/variables.js';
|
|
14
|
+
import comments from './comments.js';
|
|
15
|
+
|
|
16
|
+
/** @type {import('eslint').Linter.Config} */
|
|
17
|
+
export const baseConfig = {
|
|
18
|
+
name: '@jabworks/eslint-config-base',
|
|
19
|
+
plugins: {
|
|
20
|
+
unicorn,
|
|
21
|
+
'simple-import-sort': simpleImportSort,
|
|
22
|
+
},
|
|
23
|
+
rules: {
|
|
24
|
+
...bestPractice,
|
|
25
|
+
...es6,
|
|
26
|
+
...importConfig,
|
|
27
|
+
...possibleErrors,
|
|
28
|
+
...stylistic,
|
|
29
|
+
...variables,
|
|
30
|
+
},
|
|
31
|
+
ignores: [
|
|
32
|
+
'dist/**',
|
|
33
|
+
'build/**',
|
|
34
|
+
'out/**',
|
|
35
|
+
'coverage/**',
|
|
36
|
+
'node_modules/**',
|
|
37
|
+
'eslint.config.js',
|
|
38
|
+
'eslint.config.mjs',
|
|
39
|
+
'eslint.config.cjs',
|
|
40
|
+
'*.config.js',
|
|
41
|
+
'*.config.mjs',
|
|
42
|
+
'*.config.cjs',
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** @type {import('eslint').Linter.Config[]} */
|
|
47
|
+
const configs = [
|
|
48
|
+
eslintjs.configs.recommended,
|
|
49
|
+
eslintConfigPrettier,
|
|
50
|
+
...tseslint.configs.recommended,
|
|
51
|
+
importPlugin.flatConfigs.recommended,
|
|
52
|
+
...comments,
|
|
53
|
+
stylisticPlugin.configs.customize({
|
|
54
|
+
semi: true,
|
|
55
|
+
arrowParens: 'as-needed',
|
|
56
|
+
}),
|
|
57
|
+
baseConfig,
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
export default configs;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import comments from '@eslint-community/eslint-plugin-eslint-comments/configs';
|
|
2
|
+
import commentsRules from '../rules/comments.js';
|
|
3
|
+
|
|
4
|
+
/** @type {import('eslint').Linter.Config} */
|
|
5
|
+
export const commentsConfig = {
|
|
6
|
+
name: '@jabworks/eslint-config-comments',
|
|
7
|
+
rules: commentsRules,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/** @type {import('eslint').Linter.Config[]} */
|
|
11
|
+
const configs = [comments.recommended, commentsConfig];
|
|
12
|
+
|
|
13
|
+
export default configs;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import pluginNext from '@next/eslint-plugin-next';
|
|
3
|
+
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
4
|
+
import importPlugin from 'eslint-plugin-import';
|
|
5
|
+
import pluginReact from 'eslint-plugin-react';
|
|
6
|
+
import pluginReactHooks from 'eslint-plugin-react-hooks';
|
|
7
|
+
import globals from 'globals';
|
|
8
|
+
|
|
9
|
+
import reactRules from '../rules/react.js';
|
|
10
|
+
import baseConfig from './base.js';
|
|
11
|
+
import tseslintConfigs, { tseslintConfig } from './typescript.js';
|
|
12
|
+
|
|
13
|
+
/** @type {import('eslint').Linter.Config[]} */
|
|
14
|
+
const configs = [
|
|
15
|
+
...baseConfig,
|
|
16
|
+
js.configs.recommended,
|
|
17
|
+
eslintConfigPrettier,
|
|
18
|
+
importPlugin.flatConfigs.recommended,
|
|
19
|
+
pluginReact.configs.flat.recommended,
|
|
20
|
+
...tseslintConfigs,
|
|
21
|
+
{
|
|
22
|
+
name: '@jabworks/eslint-config-nextjs',
|
|
23
|
+
plugins: {
|
|
24
|
+
'@next/next': pluginNext,
|
|
25
|
+
'react-hooks': pluginReactHooks,
|
|
26
|
+
},
|
|
27
|
+
languageOptions: {
|
|
28
|
+
...pluginReact.configs.flat.recommended?.languageOptions,
|
|
29
|
+
globals: {
|
|
30
|
+
...globals.serviceworker,
|
|
31
|
+
},
|
|
32
|
+
parserOptions: {
|
|
33
|
+
projectService: true,
|
|
34
|
+
tsconfigRootDir: import.meta.dirname,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
settings: {
|
|
38
|
+
'import/resolver': { node: {} },
|
|
39
|
+
react: { version: 'detect' },
|
|
40
|
+
},
|
|
41
|
+
linterOptions: {
|
|
42
|
+
reportUnusedDisableDirectives: true,
|
|
43
|
+
},
|
|
44
|
+
rules: {
|
|
45
|
+
...pluginReactHooks.configs['recommended-latest'].rules,
|
|
46
|
+
...reactRules,
|
|
47
|
+
...pluginNext.configs.recommended.rules,
|
|
48
|
+
...pluginNext.configs['core-web-vitals'].rules,
|
|
49
|
+
...tseslintConfig.rules,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
files: [
|
|
54
|
+
'*.config.cjs',
|
|
55
|
+
'*.config.js',
|
|
56
|
+
'*.config.mjs',
|
|
57
|
+
'*.config.ts',
|
|
58
|
+
'**/*.d.ts',
|
|
59
|
+
'**/*.stories.ts',
|
|
60
|
+
'**/*.stories.tsx',
|
|
61
|
+
'app/**/*error.tsx',
|
|
62
|
+
'app/**/layout.tsx',
|
|
63
|
+
'app/**/not-found.tsx',
|
|
64
|
+
'app/**/opengraph-image.tsx',
|
|
65
|
+
'app/**/page.tsx',
|
|
66
|
+
'app/apple-icon.tsx',
|
|
67
|
+
'app/robots.ts',
|
|
68
|
+
'app/sitemap.ts',
|
|
69
|
+
'next.config.mjs',
|
|
70
|
+
'src/app/**/*error.tsx',
|
|
71
|
+
'src/app/**/layout.tsx',
|
|
72
|
+
'src/app/**/not-found.tsx',
|
|
73
|
+
'src/app/**/opengraph-image.tsx',
|
|
74
|
+
'src/app/**/page.tsx',
|
|
75
|
+
'src/app/apple-icon.tsx',
|
|
76
|
+
'src/app/robots.ts',
|
|
77
|
+
'src/app/sitemap.ts',
|
|
78
|
+
],
|
|
79
|
+
rules: {
|
|
80
|
+
'import/no-default-export': 'off',
|
|
81
|
+
'import/prefer-default-export': ['error', { target: 'any' }],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
export default configs;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
3
|
+
import importPlugin from 'eslint-plugin-import';
|
|
4
|
+
import pluginReact from 'eslint-plugin-react';
|
|
5
|
+
import pluginReactHooks from 'eslint-plugin-react-hooks';
|
|
6
|
+
import globals from 'globals';
|
|
7
|
+
|
|
8
|
+
import reactRules from '../rules/react.js';
|
|
9
|
+
import baseConfig from './base.js';
|
|
10
|
+
import tseslintConfig from './typescript.js';
|
|
11
|
+
|
|
12
|
+
/** @type {import("eslint").Linter.Config} */
|
|
13
|
+
export const reactConfig = {
|
|
14
|
+
name: '@jabworks/eslint-config-react',
|
|
15
|
+
languageOptions: {
|
|
16
|
+
...pluginReact.configs.flat.recommended?.languageOptions,
|
|
17
|
+
globals: {
|
|
18
|
+
...globals.serviceworker,
|
|
19
|
+
...globals.browser,
|
|
20
|
+
},
|
|
21
|
+
parserOptions: {
|
|
22
|
+
projectService: true,
|
|
23
|
+
tsconfigRootDir: import.meta.dirname,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
plugins: {
|
|
27
|
+
'react-hooks': pluginReactHooks,
|
|
28
|
+
},
|
|
29
|
+
settings: { react: { version: 'detect' } },
|
|
30
|
+
rules: {
|
|
31
|
+
...pluginReactHooks.configs['recommended-latest'].rules,
|
|
32
|
+
...reactRules,
|
|
33
|
+
'import/no-cycle': 'error',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A custom ESLint configuration for libraries that use React.
|
|
39
|
+
*
|
|
40
|
+
* @type {import("eslint").Linter.Config[]}
|
|
41
|
+
*/
|
|
42
|
+
const configs = [
|
|
43
|
+
js.configs.recommended,
|
|
44
|
+
eslintConfigPrettier,
|
|
45
|
+
importPlugin.flatConfigs.recommended,
|
|
46
|
+
...baseConfig,
|
|
47
|
+
...tseslintConfig,
|
|
48
|
+
pluginReact.configs.flat.recommended,
|
|
49
|
+
reactConfig,
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
export default configs;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
2
|
+
import importPlugin from 'eslint-plugin-import';
|
|
3
|
+
import tseslint from 'typescript-eslint';
|
|
4
|
+
|
|
5
|
+
import { TYPESCRIPT_FILES } from '../lib/constants.js';
|
|
6
|
+
import typescriptExtensionRules from '../rules/typescript.extension.js';
|
|
7
|
+
import typescriptImportRules from '../rules/typescript.import.js';
|
|
8
|
+
import typescriptRules from '../rules/typescript.js';
|
|
9
|
+
|
|
10
|
+
/** @type {import('eslint').Linter.Config} */
|
|
11
|
+
export const tseslintConfig = {
|
|
12
|
+
name: '@jabworks/eslint-config-typescript',
|
|
13
|
+
files: TYPESCRIPT_FILES,
|
|
14
|
+
rules: {
|
|
15
|
+
...typescriptRules,
|
|
16
|
+
...typescriptExtensionRules,
|
|
17
|
+
...typescriptImportRules,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @type {import('eslint').Linter.Config[]} */
|
|
22
|
+
const configs = [
|
|
23
|
+
...tseslint.configs.strictTypeChecked,
|
|
24
|
+
...tseslint.configs.stylisticTypeChecked,
|
|
25
|
+
importPlugin.flatConfigs.typescript,
|
|
26
|
+
eslintConfigPrettier,
|
|
27
|
+
tseslintConfig,
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export default configs;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import vitest from '@vitest/eslint-plugin';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
|
|
4
|
+
import vitestRules from '../rules/vitest.js';
|
|
5
|
+
|
|
6
|
+
/** @type {import('eslint').Linter.Config[]} */
|
|
7
|
+
const configs = [
|
|
8
|
+
{
|
|
9
|
+
name: '@jabworks/eslint-config-vitest',
|
|
10
|
+
files: ['**/*.test.{js,ts,mjs,cjs,jsx,tsx}', '**/__tests__/**', '**/tests/**'],
|
|
11
|
+
plugins: {
|
|
12
|
+
vitest,
|
|
13
|
+
},
|
|
14
|
+
languageOptions: {
|
|
15
|
+
globals: {
|
|
16
|
+
...globals.node,
|
|
17
|
+
...globals.vitest,
|
|
18
|
+
vi: 'readonly',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
rules: {
|
|
22
|
+
...vitest.configs.recommended.rules,
|
|
23
|
+
...vitestRules,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
export default configs;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import pkg from '../package.json' with { type: 'json' };
|
|
2
|
+
import base from './configs/base.js';
|
|
3
|
+
import comments from './configs/comments.js';
|
|
4
|
+
import next from './configs/next.js';
|
|
5
|
+
import react from './configs/react.js';
|
|
6
|
+
import typescript from './configs/typescript.js';
|
|
7
|
+
import vitest from './configs/vitest.js';
|
|
8
|
+
|
|
9
|
+
const { name, version } = pkg;
|
|
10
|
+
|
|
11
|
+
/** @type {import('eslint').ESLint.Plugin} */
|
|
12
|
+
export const plugin = {
|
|
13
|
+
meta: {
|
|
14
|
+
name,
|
|
15
|
+
version,
|
|
16
|
+
},
|
|
17
|
+
configs: {
|
|
18
|
+
base,
|
|
19
|
+
comments,
|
|
20
|
+
next,
|
|
21
|
+
react,
|
|
22
|
+
typescript,
|
|
23
|
+
vitest,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
2
|
+
const rules = {
|
|
3
|
+
/**
|
|
4
|
+
* Require return statements in array methods callbacks.
|
|
5
|
+
*
|
|
6
|
+
* 🚫 Not fixable -https://eslint.org/docs/rules/array-callback-return
|
|
7
|
+
*/
|
|
8
|
+
'array-callback-return': ['error', { allowImplicit: true }],
|
|
9
|
+
/**
|
|
10
|
+
* Treat `var` statements as if they were block scoped.
|
|
11
|
+
*
|
|
12
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/block-scoped-var
|
|
13
|
+
*/
|
|
14
|
+
'block-scoped-var': 'error',
|
|
15
|
+
/**
|
|
16
|
+
* Require curly braces for multiline blocks.
|
|
17
|
+
*
|
|
18
|
+
* 🔧 Fixable - https://eslint.org/docs/rules/curly
|
|
19
|
+
*/
|
|
20
|
+
curly: ['warn', 'multi-line'],
|
|
21
|
+
/**
|
|
22
|
+
* Require default clauses in switch statements to be last (if used).
|
|
23
|
+
*
|
|
24
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/default-case-last
|
|
25
|
+
*/
|
|
26
|
+
'default-case-last': 'error',
|
|
27
|
+
/**
|
|
28
|
+
* Require triple equals (`===` and `!==`).
|
|
29
|
+
*
|
|
30
|
+
* 🔧 Fixable - https://eslint.org/docs/rules/eqeqeq
|
|
31
|
+
*/
|
|
32
|
+
eqeqeq: 'error',
|
|
33
|
+
/**
|
|
34
|
+
* Require grouped accessor pairs in object literals and classes.
|
|
35
|
+
*
|
|
36
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/grouped-accessor-pairs
|
|
37
|
+
*/
|
|
38
|
+
'grouped-accessor-pairs': 'error',
|
|
39
|
+
/**
|
|
40
|
+
* Disallow use of `alert()`.
|
|
41
|
+
*
|
|
42
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-alert
|
|
43
|
+
*/
|
|
44
|
+
'no-alert': 'error',
|
|
45
|
+
/**
|
|
46
|
+
* Disallow use of `caller`/`callee`.
|
|
47
|
+
*
|
|
48
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-caller
|
|
49
|
+
*/
|
|
50
|
+
'no-caller': 'error',
|
|
51
|
+
/**
|
|
52
|
+
* Disallow returning value in constructor.
|
|
53
|
+
*
|
|
54
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-constructor-return
|
|
55
|
+
*/
|
|
56
|
+
'no-constructor-return': 'error',
|
|
57
|
+
/**
|
|
58
|
+
* Disallow using an `else` if the `if` block contains a return.
|
|
59
|
+
*
|
|
60
|
+
* 🔧 Fixable - https://eslint.org/docs/rules/no-else-return
|
|
61
|
+
*/
|
|
62
|
+
'no-else-return': 'warn',
|
|
63
|
+
/**
|
|
64
|
+
* Disallow `eval()`.
|
|
65
|
+
*
|
|
66
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-eval
|
|
67
|
+
*/
|
|
68
|
+
'no-eval': 'error',
|
|
69
|
+
/**
|
|
70
|
+
* Disallow extending native objects.
|
|
71
|
+
*
|
|
72
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-extend-native
|
|
73
|
+
*/
|
|
74
|
+
'no-extend-native': 'error',
|
|
75
|
+
/**
|
|
76
|
+
* Disallow unnecessary function binding.
|
|
77
|
+
*
|
|
78
|
+
* 🔧 Fixable - https://eslint.org/docs/rules/no-extra-bind
|
|
79
|
+
*/
|
|
80
|
+
'no-extra-bind': 'error',
|
|
81
|
+
/**
|
|
82
|
+
* Disallow unnecessary labels.
|
|
83
|
+
*
|
|
84
|
+
* 🔧 Fixable - https://eslint.org/docs/rules/no-extra-label
|
|
85
|
+
*/
|
|
86
|
+
'no-extra-label': 'error',
|
|
87
|
+
/**
|
|
88
|
+
* Disallow floating decimals.
|
|
89
|
+
*
|
|
90
|
+
* 🔧 Fixable - https://eslint.org/docs/rules/no-floating-decimal
|
|
91
|
+
*/
|
|
92
|
+
'no-floating-decimal': 'error',
|
|
93
|
+
/**
|
|
94
|
+
* Make people convert types explicitly e.g. `Boolean(foo)` instead of `!!foo`.
|
|
95
|
+
*
|
|
96
|
+
* 🔧 Partially Fixable - https://eslint.org/docs/rules/no-implicit-coercion
|
|
97
|
+
*/
|
|
98
|
+
'no-implicit-coercion': 'error',
|
|
99
|
+
/**
|
|
100
|
+
* Disallow use of `eval()`-like methods.
|
|
101
|
+
*
|
|
102
|
+
* https://eslint.org/docs/rules/no-implied-eval
|
|
103
|
+
*/
|
|
104
|
+
'no-implied-eval': 'error',
|
|
105
|
+
/**
|
|
106
|
+
* Disallow usage of `__iterator__` property.
|
|
107
|
+
*
|
|
108
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-iterator
|
|
109
|
+
*/
|
|
110
|
+
'no-iterator': 'error',
|
|
111
|
+
/**
|
|
112
|
+
* Disallow use of labels for anything other than loops and switches.
|
|
113
|
+
*
|
|
114
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-labels
|
|
115
|
+
*/
|
|
116
|
+
'no-labels': ['error'],
|
|
117
|
+
/**
|
|
118
|
+
* Disallow unnecessary nested blocks.
|
|
119
|
+
*
|
|
120
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-lone-blocks
|
|
121
|
+
*/
|
|
122
|
+
'no-lone-blocks': 'error',
|
|
123
|
+
/**
|
|
124
|
+
* Disallow `new` for side effects.
|
|
125
|
+
*
|
|
126
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-new
|
|
127
|
+
*/
|
|
128
|
+
'no-new': 'error',
|
|
129
|
+
/**
|
|
130
|
+
* Disallow function constructors.
|
|
131
|
+
*
|
|
132
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-new-func
|
|
133
|
+
*/
|
|
134
|
+
'no-new-func': 'error',
|
|
135
|
+
/**
|
|
136
|
+
* Disallow primitive wrapper instances, such as `new String('foo')`.
|
|
137
|
+
*
|
|
138
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-new-wrappers
|
|
139
|
+
*/
|
|
140
|
+
'no-new-wrappers': 'error',
|
|
141
|
+
/**
|
|
142
|
+
* Disallow use of octal escape sequences in string literals.
|
|
143
|
+
*
|
|
144
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-octal-escape
|
|
145
|
+
*/
|
|
146
|
+
'no-octal-escape': 'error',
|
|
147
|
+
/**
|
|
148
|
+
* Disallow reassignment of function parameters.
|
|
149
|
+
*
|
|
150
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-param-reassign
|
|
151
|
+
*/
|
|
152
|
+
'no-param-reassign': 'error',
|
|
153
|
+
/**
|
|
154
|
+
* Disallow usage of the deprecated `__proto__` property.
|
|
155
|
+
*
|
|
156
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-proto
|
|
157
|
+
*/
|
|
158
|
+
'no-proto': 'error',
|
|
159
|
+
/**
|
|
160
|
+
* Disallow assignment in `return` statement.
|
|
161
|
+
*
|
|
162
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-return-assign
|
|
163
|
+
*/
|
|
164
|
+
'no-return-assign': 'error',
|
|
165
|
+
/**
|
|
166
|
+
* Disallow use of `javascript:` urls.
|
|
167
|
+
*
|
|
168
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-script-url
|
|
169
|
+
*/
|
|
170
|
+
'no-script-url': 'error',
|
|
171
|
+
/**
|
|
172
|
+
* Disallow comparisons where both sides are exactly the same.
|
|
173
|
+
*
|
|
174
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-self-compare
|
|
175
|
+
*/
|
|
176
|
+
'no-self-compare': 'error',
|
|
177
|
+
/**
|
|
178
|
+
* Disallow use of comma operator.
|
|
179
|
+
*
|
|
180
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-sequences
|
|
181
|
+
*/
|
|
182
|
+
'no-sequences': 'error',
|
|
183
|
+
/**
|
|
184
|
+
* Disallow unnecessary `.call()` and `.apply()`.
|
|
185
|
+
*
|
|
186
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-call
|
|
187
|
+
*/
|
|
188
|
+
'no-useless-call': 'error',
|
|
189
|
+
/**
|
|
190
|
+
* Disallow unnecessary concatenation of strings.
|
|
191
|
+
*
|
|
192
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-concat
|
|
193
|
+
*/
|
|
194
|
+
'no-useless-concat': 'error',
|
|
195
|
+
/**
|
|
196
|
+
* Disallow redundant return statements.
|
|
197
|
+
*
|
|
198
|
+
* 🔧 Fixable - https://eslint.org/docs/rules/no-useless-return
|
|
199
|
+
*/
|
|
200
|
+
'no-useless-return': 'warn',
|
|
201
|
+
/**
|
|
202
|
+
* Require using named capture groups in regular expressions.
|
|
203
|
+
*
|
|
204
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/prefer-named-capture-group
|
|
205
|
+
*/
|
|
206
|
+
// 'prefer-named-capture-group': 'error',
|
|
207
|
+
/**
|
|
208
|
+
* Require using Error objects as Promise rejection reasons.
|
|
209
|
+
*
|
|
210
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/prefer-promise-reject-errors
|
|
211
|
+
*/
|
|
212
|
+
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
|
|
213
|
+
/**
|
|
214
|
+
* Disallow use of the RegExp constructor in favor of regular expression
|
|
215
|
+
* literals.
|
|
216
|
+
*
|
|
217
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/prefer-regex-literals
|
|
218
|
+
*/
|
|
219
|
+
'prefer-regex-literals': 'error',
|
|
220
|
+
/**
|
|
221
|
+
* Disallow "Yoda conditions", ensuring the comparison.
|
|
222
|
+
*
|
|
223
|
+
* 🔧 Fixable - https://eslint.org/docs/rules/yoda
|
|
224
|
+
*/
|
|
225
|
+
yoda: 'warn',
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export default rules;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
2
|
+
const rules = {
|
|
3
|
+
'@eslint-community/eslint-comments/disable-enable-pair': 'off',
|
|
4
|
+
/**
|
|
5
|
+
* Require comments on ESlint disable directives.
|
|
6
|
+
*
|
|
7
|
+
* 🚫 Not fixable - https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/require-description.html
|
|
8
|
+
*/
|
|
9
|
+
'@eslint-community/eslint-comments/require-description': 'error',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default rules;
|