eslint-config-dolmios 1.11.0 → 2.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/README.md CHANGED
@@ -1,66 +1,77 @@
1
1
  # eslint-config-dolmios
2
+ > A comprehensive ESLint (9) setup using [@typescript-eslint](https://typescript-eslint.io), integrated with Prettier and tailored TSConfig setups for modern JavaScript and TypeScript projects. This config is designed for my projects, but feel free to use it as a starting point for your own projects.
2
3
 
3
- > A simple ESLint setup using [@typescript-eslint](https://typescript-eslint.io), with Prettier and a couple TSConfig setups.
4
4
 
5
5
  ## Install
6
-
7
6
  ```sh
8
- pnpm add eslint-config-dolmios
7
+ pnpm add eslint-config-dolmios
9
8
  ```
10
9
 
11
10
  ## Usage
11
+ This ESLint configuration is designed for use with ESLint v9, which uses a flat config format. Follow the steps below to integrate it into your project.
12
12
 
13
- Populate `.eslintrc` with the following, and code away.
13
+ ### Setting Up ESLint
14
+ 1. **Create an ESLint Configuration File**: In the root of your project, create a file named `eslint.config.js`.
14
15
 
15
- ```
16
- "extends": ["dolmios"]
17
- ```
16
+ 2. **Import and Extend the Configuration**: Add the following content to `eslint.config.js` to use the `eslint-config-dolmios` configuration:
18
17
 
19
- Alternatively, you can use `eslintConfig` in `package.json`.
20
18
 
21
- ```
22
- "eslintConfig": {
23
- "extends": ["dolmios"]
24
- }
19
+ ```js
20
+ import dolmiosConfig from "eslint-config-dolmios";
21
+
22
+ export default [
23
+ ...dolmiosConfig,
24
+ // Add any project-specific overrides here
25
+ ];
25
26
  ```
26
27
 
27
- ### Usage with Prettier
28
+ ---
28
29
 
29
- Prettier is configured to work nicely with this config, though is an optional inclusion. If you'd like to include the config, you can add it to `package.json`.
30
+ ### Usage with Prettier
31
+ Prettier is configured to work seamlessly with this ESLint setup. To include Prettier, add the configuration to your `package.json`:
30
32
 
31
- ```
33
+ ```js
32
34
  "prettier": "eslint-config-dolmios/configs/prettier"
33
35
  ```
34
36
 
35
37
  #### Extending Prettier
38
+ If you need to extend the Prettier configuration, you can do so by creating a `.prettierrc.js` file and exporting your modifications:
36
39
 
37
- > The above method does **not** offer a way to _extend_ the configuration to overwrite some properties from the shared configuration. If you need to do that, import the file in a `.prettierrc.js` file and export the modifications.
40
+ For more details, refer to the [Prettier documentation](https://prettier.io/docs/en/configuration.html#sharing-configurations).
38
41
 
39
- > [https://prettier.io/docs/en/](https://prettier.io/docs/en/configuration.html#sharing-configurations)
40
-
41
- ```
42
+ ```js
42
43
  module.exports = {
43
- ...require("eslint-config-dolmios/configs/prettier"),
44
- parser: "babel",
44
+ ...require("eslint-config-dolmios/configs/prettier"),
45
+ parser: "babel",
45
46
  };
46
47
  ```
47
48
 
48
- ### Usage with TSConfig
49
+ ---
49
50
 
51
+ ### Usage with TSConfig
50
52
  This config also exports two TSConfig setups, `base` and `lib` respectively. The _base_ config is generally suitable. To include either, extend your `tsconfig.json`.
51
53
 
52
- ```
53
- "extends": "eslint-config-dolmios/configs/tsconfig"
54
+
54
55
  ```
55
56
 
56
- ## Configurations
57
+ "extends": "eslint-config-dolmios/configs/tsconfig"
57
58
 
58
- You can view the ESLint configuration in the reference notes: [reference.txt](./reference.txt).
59
+ ```
59
60
 
60
- ## Contributing
61
+
61
62
 
62
- Feel free to get in touch with feedback, advice or suggestions. See [Conventional Commits](https://gist.github.com/dolmios/0e33c579a500d87fc6f44df6cde97259) for new contributors.
63
+ ## Configurations
64
+ You can view the ESLint configuration in the reference notes: [reference.txt](./reference.txt).
63
65
 
64
66
  ## Acknowledgments
67
+ This configuration leverages several third-party libraries to enhance linting and formatting capabilities:
68
+
69
+ - **[@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint)**: Provides TypeScript-specific linting rules.
70
+ - **[eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)**: Enforces the rules of React Hooks.
71
+ - **[eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)**: Static AST checker for accessibility rules on JSX elements.
72
+ - **[eslint-plugin-next](https://github.com/vercel/next.js/tree/canary/packages/eslint-plugin-next)**: Provides Next.js specific linting rules.
73
+ - **[eslint-plugin-perfectionist](https://github.com/azat-io/eslint-plugin-perfectionist)**: Handles sorting of imports, objects, and other elements for a consistent codebase.
74
+ - **[eslint-config-prettier](https://github.com/prettier/eslint-config-prettier)**: Disables ESLint rules that might conflict with Prettier.
65
75
 
66
- - [eslint-plugin-typescript-sort-keys](https://github.com/infctr/eslint-plugin-typescript-sort-keys#readme)
76
+ ## License
77
+ This project is licensed under the MIT License.
@@ -0,0 +1,46 @@
1
+ // eslint.config.js
2
+ import js from '@eslint/js';
3
+ import tseslint from '@typescript-eslint/eslint-plugin';
4
+ import tsParser from '@typescript-eslint/parser';
5
+ import jsxA11y from 'eslint-plugin-jsx-a11y';
6
+ import nextPlugin from '@next/eslint-plugin-next';
7
+ import react from 'eslint-plugin-react';
8
+ import reactHooks from 'eslint-plugin-react-hooks';
9
+ import perfectionist from 'eslint-plugin-perfectionist';
10
+ import customRules from './rules.js';
11
+ import globals from 'globals';
12
+
13
+ export default [
14
+ js.configs.recommended,
15
+ {
16
+ files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
17
+ languageOptions: {
18
+ parser: tsParser,
19
+ parserOptions: {
20
+ ecmaVersion: 'latest',
21
+ sourceType: 'module',
22
+ ecmaFeatures: { jsx: true },
23
+ },
24
+ globals: {
25
+ ...globals.browser,
26
+ ...globals.node
27
+ }
28
+ },
29
+ linterOptions: {
30
+ reportUnusedDisableDirectives: 'warn',
31
+ },
32
+ plugins: {
33
+ '@typescript-eslint': tseslint,
34
+ '@next/next': nextPlugin,
35
+ 'perfectionist': perfectionist,
36
+ 'react': react,
37
+ 'react-hooks': reactHooks,
38
+ 'jsx-a11y': jsxA11y,
39
+ },
40
+ settings: {
41
+ react: { version: 'detect' },
42
+ next: { rootDir: './' },
43
+ },
44
+ rules: customRules,
45
+ },
46
+ ];
package/package.json CHANGED
@@ -1,44 +1,54 @@
1
1
  {
2
2
  "name": "eslint-config-dolmios",
3
+ "version": "2.0.0",
3
4
  "description": "A simple ESLint config with Prettier and a couple TSConfig setups",
4
- "version": "1.11.0",
5
5
  "author": "Jackson Dolman <mail@dolmios.com>",
6
6
  "bugs": {
7
7
  "url": "https://github.com/dolmios/eslint-config-dolmios/issues"
8
8
  },
9
- "dependencies": {
10
- "@typescript-eslint/eslint-plugin": "^8.3.0",
11
- "@typescript-eslint/parser": "^8.3.0",
12
- "eslint": "^8.57.0",
13
- "eslint-config-next": "^14.2.6",
14
- "eslint-config-prettier": "^9.1.0",
15
- "eslint-plugin-typescript-sort-keys": "^3.2.0",
16
- "prettier": "^3.3.3",
17
- "typescript": "^5.5.4"
9
+ "devDependencies": {
10
+ "@eslint/js": "^9.21.0",
11
+ "@next/eslint-plugin-next": "^15.2.1",
12
+ "@typescript-eslint/eslint-plugin": "^8.26.0",
13
+ "@typescript-eslint/parser": "^8.26.0",
14
+ "eslint": "^9.21.0",
15
+ "eslint-plugin-jsx-a11y": "^6.10.2",
16
+ "eslint-plugin-perfectionist": "^4.9.0",
17
+ "eslint-plugin-react": "^7.37.4",
18
+ "eslint-plugin-react-hooks": "^5.2.0",
19
+ "globals": "^16.0.0",
20
+ "next": "^15.2.1",
21
+ "prettier": "^3.5.3",
22
+ "typescript": "^5.8.2"
18
23
  },
24
+ "peerDependencies": {
25
+ "eslint": "^9.0.0",
26
+ "react": ">=19.0.0",
27
+ "react-dom": ">=19.0.0"
28
+ },
29
+ "files": [
30
+ "eslint.config.js",
31
+ "rules.js"
32
+ ],
19
33
  "homepage": "https://github.com/dolmios/eslint-config-dolmios#readme",
20
34
  "keywords": [
21
- "eslint",
22
35
  "config",
36
+ "eslint",
23
37
  "linting",
24
- "typescript",
25
- "prettier"
26
- ],
27
- "files": [
28
- "configs",
29
- "index.js"
38
+ "prettier",
39
+ "typescript"
30
40
  ],
31
41
  "license": "MIT",
32
- "main": "index.js",
33
- "prettier": "./configs/prettier.json",
42
+ "main": "eslint.config.js",
34
43
  "repository": {
35
44
  "type": "git",
36
45
  "url": "git+https://github.com/dolmios/eslint-config-dolmios.git"
37
46
  },
47
+ "type": "module",
38
48
  "scripts": {
39
- "lint": "eslint --ext .js",
40
- "prettier": "prettier --write .",
41
- "print": "eslint --print-config index.js > reference.txt",
49
+ "lint": "eslint ./test.js",
50
+ "prettier": "prettier --write ./test.js",
51
+ "print": "eslint --print-config ./test.js > reference.txt",
42
52
  "tidy": "pnpm lint && pnpm prettier"
43
53
  }
44
54
  }
package/rules.js ADDED
@@ -0,0 +1,155 @@
1
+ // rules.js - Custom ESLint rules
2
+
3
+ // TypeScript specific rules
4
+ const typescriptRules = {
5
+ '@typescript-eslint/explicit-function-return-type': 'warn',
6
+ '@typescript-eslint/no-non-null-assertion': 'warn',
7
+ '@typescript-eslint/no-unused-vars': [
8
+ 'warn',
9
+ { args: 'none', ignoreRestSiblings: true, argsIgnorePattern: '^_' },
10
+ ],
11
+ 'no-unused-vars': 'off',
12
+ };
13
+
14
+ // Accessibility rules
15
+ const a11yRules = {
16
+ 'jsx-a11y/aria-role': 'warn',
17
+ 'jsx-a11y/autocomplete-valid': 'warn',
18
+ 'jsx-a11y/click-events-have-key-events': 'warn',
19
+ 'jsx-a11y/heading-has-content': 'warn',
20
+ 'jsx-a11y/html-has-lang': 'warn',
21
+ 'jsx-a11y/iframe-has-title': 'warn',
22
+ 'jsx-a11y/img-redundant-alt': 'warn',
23
+ 'jsx-a11y/interactive-supports-focus': 'warn',
24
+ 'jsx-a11y/label-has-associated-control': 'warn',
25
+ 'jsx-a11y/lang': 'warn',
26
+ 'jsx-a11y/media-has-caption': 'warn',
27
+ 'jsx-a11y/mouse-events-have-key-events': 'warn',
28
+ 'jsx-a11y/no-access-key': 'warn',
29
+ 'jsx-a11y/no-autofocus': 'warn',
30
+ 'jsx-a11y/no-distracting-elements': 'warn',
31
+ 'jsx-a11y/no-redundant-roles': 'warn',
32
+ 'jsx-a11y/no-static-element-interactions': 'warn',
33
+ 'jsx-a11y/scope': 'warn',
34
+ };
35
+
36
+ // React specific rules
37
+ const reactRules = {
38
+ 'react/button-has-type': 'warn',
39
+ 'react/destructuring-assignment': 'warn',
40
+ 'react/display-name': 'off',
41
+ 'react/jsx-boolean-value': 'warn',
42
+ 'react/jsx-handler-names': 'warn',
43
+ 'react/jsx-no-bind': [
44
+ 'warn',
45
+ { allowArrowFunctions: true, ignoreRefs: true },
46
+ ],
47
+ 'react/jsx-no-useless-fragment': 'warn',
48
+ 'react/jsx-pascal-case': 'warn',
49
+ 'react/jsx-sort-props': [
50
+ 'warn',
51
+ {
52
+ 'callbacksLast': true,
53
+ 'ignoreCase': true,
54
+ 'noSortAlphabetically': false,
55
+ 'reservedFirst': true,
56
+ 'shorthandFirst': false,
57
+ 'shorthandLast': false,
58
+ }
59
+ ],
60
+ 'react/no-access-state-in-setstate': 'warn',
61
+ 'react/no-arrow-function-lifecycle': 'warn',
62
+ 'react/no-danger': 'warn',
63
+ 'react/no-invalid-html-attribute': 'warn',
64
+ 'react/no-set-state': 'warn',
65
+ 'react/no-this-in-sfc': 'warn',
66
+ 'react/no-typos': 'warn',
67
+ 'react/no-unused-state': 'warn',
68
+ 'react/self-closing-comp': 'warn',
69
+ 'react/sort-comp': 'warn',
70
+ 'react/style-prop-object': 'warn',
71
+ 'react/void-dom-elements-no-children': 'warn',
72
+ 'react-hooks/exhaustive-deps': 'warn',
73
+ 'react-hooks/rules-of-hooks': 'error',
74
+ };
75
+
76
+ // Next.js rules
77
+ const nextRules = {
78
+ '@next/next/no-html-link-for-pages': 'warn',
79
+ '@next/next/no-img-element': 'warn',
80
+ '@next/next/no-unwanted-polyfillio': 'warn',
81
+ };
82
+
83
+ // Perfectionist rules
84
+ const perfectionistRules = {
85
+ 'perfectionist/sort-objects': ['warn', { order: 'asc', type: 'natural' }],
86
+ 'perfectionist/sort-imports': ['warn', { order: 'asc', type: 'natural' }],
87
+ };
88
+
89
+ // General JavaScript rules
90
+ const generalRules = {
91
+ 'consistent-this': ['warn', 'self'],
92
+ 'eqeqeq': 'warn',
93
+ 'no-alert': 'warn',
94
+ 'no-console': 'warn',
95
+ 'no-duplicate-imports': 'warn',
96
+ 'no-empty': 'warn',
97
+ 'no-eq-null': 'warn',
98
+ 'no-eval': 'warn',
99
+ 'no-extra-bind': 'warn',
100
+ 'no-extra-label': 'warn',
101
+ 'no-invalid-this': 'warn',
102
+ 'no-iterator': 'warn',
103
+ 'no-label-var': 'warn',
104
+ 'no-labels': 'warn',
105
+ 'no-lone-blocks': 'warn',
106
+ 'no-mixed-requires': ['warn', { grouping: true, allowCall: false }],
107
+ 'no-multi-spaces': 'warn',
108
+ 'no-multi-str': 'warn',
109
+ 'no-multiple-empty-lines': [
110
+ 'warn',
111
+ { max: 1, maxBOF: 0, maxEOF: 0 },
112
+ ],
113
+ 'no-new': 'warn',
114
+ 'no-octal-escape': 'warn',
115
+ 'no-proto': 'warn',
116
+ 'no-template-curly-in-string': 'warn',
117
+ 'no-unreachable-loop': 'warn',
118
+ 'no-unused-expressions': 'warn',
119
+ 'no-unused-labels': 'warn',
120
+ 'no-use-before-define': 'warn',
121
+ 'no-useless-backreference': 'warn',
122
+ 'no-useless-call': 'warn',
123
+ 'no-useless-catch': 'warn',
124
+ 'no-useless-computed-key': 'warn',
125
+ 'no-useless-concat': 'warn',
126
+ 'no-useless-constructor': 'warn',
127
+ 'no-useless-escape': 'warn',
128
+ 'no-useless-return': 'warn',
129
+ 'no-var': 'error',
130
+ 'padding-line-between-statements': [
131
+ 'warn',
132
+ { blankLine: 'always', next: 'return', prev: '*' },
133
+ { blankLine: 'always', next: '*', prev: ['const', 'let', 'var'] },
134
+ { blankLine: 'any', next: ['const', 'let', 'var'], prev: ['const', 'let', 'var'] },
135
+ ],
136
+ 'prefer-destructuring': ['warn', { array: true, object: true }],
137
+ 'yoda': 'warn',
138
+ };
139
+
140
+ // Prettier compatibility rules
141
+ const prettierRules = {
142
+ 'arrow-body-style': 'off',
143
+ 'prefer-arrow-callback': 'off',
144
+ };
145
+
146
+ // Export all rule groups combined
147
+ export default {
148
+ ...typescriptRules,
149
+ ...a11yRules,
150
+ ...reactRules,
151
+ ...nextRules,
152
+ ...perfectionistRules,
153
+ ...generalRules,
154
+ ...prettierRules,
155
+ };
@@ -1,28 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/tsconfig",
3
- "compilerOptions": {
4
- "module": "esnext",
5
- "importHelpers": true,
6
- "declaration": true,
7
- "sourceMap": true,
8
- "strict": true,
9
- "noImplicitReturns": true,
10
- "noFallthroughCasesInSwitch": true,
11
- "noUnusedLocals": true,
12
- "noUnusedParameters": true,
13
- "moduleResolution": "node",
14
- "esModuleInterop": true,
15
- "skipLibCheck": true,
16
- "forceConsistentCasingInFileNames": true,
17
- "allowSyntheticDefaultImports": true,
18
- "jsx": "react-jsx",
19
- "lib": ["dom", "dom.iterable", "esnext"],
20
- "target": "es2022",
21
- "allowJs": true,
22
- "resolveJsonModule": true,
23
- "isolatedModules": true,
24
- "emitDecoratorMetadata": true,
25
- "experimentalDecorators": true
26
- },
27
- "display": "dolmios"
28
- }
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "http://json.schemastore.org/prettierrc",
3
- "bracketSameLine": true,
4
- "printWidth": 100,
5
- "endOfLine": "lf"
6
- }
package/configs/swc.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/swcrc",
3
- "jsc": {
4
- "parser": {
5
- "decorators": true,
6
- "dynamicImport": true,
7
- "syntax": "typescript",
8
- "tsx": true
9
- },
10
- "target": "es2022"
11
- },
12
- "minify": false,
13
- "module": {
14
- "type": "es6"
15
- }
16
- }
@@ -1,29 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/tsconfig",
3
- "compilerOptions": {
4
- "allowJs": true, // Allows JavaScript files to be compiled
5
- "esModuleInterop": true, // Enables default imports from modules with no default export
6
- "forceConsistentCasingInFileNames": true, // Disallows inconsistently-cased references to the same file
7
- "incremental": true, // Enables incremental compilation
8
- "isolatedModules": true, // Ensures each file can be safely transpiled without relying on other imports
9
- "jsx": "preserve", // Preserves JSX as part of the output to be further consumed by another transform step
10
- "lib": ["dom", "dom.iterable", "esnext"], // Specifies library files to be included in the compilation
11
- "module": "esnext", // Specifies module code generation
12
- "moduleResolution": "node", // Specifies module resolution strategy
13
- "noEmit": true, // Suppresses output of .js files
14
- "resolveJsonModule": true, // Allows importing of JSON modules
15
- "skipLibCheck": true, // Skips type checking of declaration files
16
- "strict": true, // Enables all strict type-checking options
17
- "strictNullChecks": true, // Enforces strict null checks
18
- "noImplicitAny": true, // Raises an error on expressions and declarations with an implied 'any' type
19
- "noImplicitReturns": true, // Raises an error when not all code paths in a function return a value
20
- "noImplicitThis": true, // Raises an error on 'this' expressions with an implied 'any' type
21
- "alwaysStrict": true, // Parse in strict mode and emit "use strict" for each source file
22
- "noUnusedLocals": true, // Reports errors on unused locals
23
- "noUnusedParameters": true, // Reports errors on unused parameters
24
- "experimentalDecorators": true, // Enables experimental support for ES7 decorators
25
- "emitDecoratorMetadata": true, // Emits design-type metadata for decorated declarations in source
26
- "target": "es2022" // Specifies ECMAScript target version
27
- },
28
- "display": "dolmios"
29
- }
package/index.js DELETED
@@ -1,173 +0,0 @@
1
- module.exports = {
2
- extends: [
3
- "plugin:import/recommended",
4
- "next/core-web-vitals",
5
- "plugin:@typescript-eslint/recommended",
6
- "prettier",
7
- ],
8
- root: true,
9
- ignorePatterns: ["next-env.d.ts", "next.config.js"],
10
- parser: "@typescript-eslint/parser",
11
- plugins: ["typescript-sort-keys"],
12
- rules: {
13
- "@next/next/no-html-link-for-pages": ["off"], // Disables Next.js specific rule for HTML links in pages
14
- "@typescript-eslint/explicit-function-return-type": ["warn"], // Warns about missing return types for functions
15
- "@typescript-eslint/no-non-null-assertion": ["warn"], // Warns about non-null assertions
16
- "import/first": ["warn"], // Ensures all imports appear before other statements
17
- "import/order": [
18
- "warn",
19
- {
20
- alphabetize: {
21
- caseInsensitive: true,
22
- order: "asc",
23
- },
24
- groups: ["builtin", "external", "parent", "sibling", "index"],
25
- "newlines-between": "always",
26
- warnOnUnassignedImports: false,
27
- },
28
- ], // Enforces a consistent import order
29
- "jsx-a11y/aria-role": ["warn"], // Warns about incorrect use of ARIA roles
30
- "jsx-a11y/autocomplete-valid": ["warn"], // Ensures autocomplete attributes are valid
31
- "jsx-a11y/click-events-have-key-events": ["warn"], // Ensures clickable elements have keyboard events
32
- "jsx-a11y/heading-has-content": ["warn"], // Ensures heading elements have content
33
- "jsx-a11y/html-has-lang": ["warn"], // Ensures HTML has a lang attribute
34
- "jsx-a11y/iframe-has-title": ["warn"], // Ensures iframes have a title attribute
35
- "jsx-a11y/img-redundant-alt": ["warn"], // Warns about redundant alt text for images
36
- "jsx-a11y/interactive-supports-focus": ["warn"], // Ensures interactive elements support focus
37
- "jsx-a11y/label-has-associated-control": ["warn"], // Ensures labels are associated with controls
38
- "jsx-a11y/lang": ["warn"], // Ensures elements with a global ARIA role have a valid lang attribute
39
- "jsx-a11y/media-has-caption": ["warn"], // Ensures media elements have captions
40
- "jsx-a11y/mouse-events-have-key-events": ["warn"], // Ensures mouse events have corresponding keyboard events
41
- "jsx-a11y/no-access-key": ["warn"], // Warns about the use of access keys
42
- "jsx-a11y/no-autofocus": ["warn"], // Warns about the use of autofocus
43
- "jsx-a11y/no-distracting-elements": ["warn"], // Warns about elements that can be distracting
44
- "jsx-a11y/no-redundant-roles": ["warn"], // Warns about redundant roles
45
- "jsx-a11y/no-static-element-interactions": ["warn"], // Warns about static elements with interactive handlers
46
- "jsx-a11y/scope": ["warn"], // Ensures scope elements have a valid scope attribute
47
- "no-alert": ["warn"], // Warns about the use of alert
48
- "no-console": ["warn"], // Warns about the use of console
49
- "no-duplicate-imports": ["warn"], // Warns about duplicate imports
50
- "no-empty": ["warn"], // Warns about empty blocks
51
- "no-eq-null": ["warn"], // Warns about comparisons with null using == or !=
52
- "no-eval": ["warn"], // Warns about the use of eval
53
- "no-extra-bind": ["warn"], // Warns about unnecessary bind calls
54
- "no-extra-label": ["warn"], // Warns about unnecessary labels
55
- "no-invalid-this": ["warn"], // Warns about invalid this usage
56
- "no-iterator": ["warn"], // Warns about the use of the __iterator__ property
57
- "no-label-var": ["warn"], // Warns about labels that shadow variable names
58
- "no-labels": ["warn"], // Warns about the use of labels
59
- "no-lone-blocks": ["warn"], // Warns about unnecessary blocks
60
- "no-multi-str": ["warn"], // Warns about multi-line strings
61
- "no-new": ["warn"], // Warns about the use of the new operator with side effects
62
- "no-octal-escape": ["warn"], // Warns about octal escape sequences
63
- "no-proto": ["warn"], // Warns about the use of __proto__
64
- "no-template-curly-in-string": ["warn"], // Warns about template literals misused as string literals
65
- "no-unreachable-loop": ["warn"], // Warns about loops that don't loop
66
- "no-unused-expressions": ["warn"], // Warns about unused expressions
67
- "no-unused-labels": ["warn"], // Warns about unused labels
68
- "no-useless-backreference": ["warn"], // Warns about unnecessary backreferences in regular expressions
69
- "@typescript-eslint/no-unused-vars": [
70
- "warn",
71
- {
72
- args: "none",
73
- ignoreRestSiblings: true,
74
- argsIgnorePattern: "^_", // Ignores arguments that start with an underscore
75
- },
76
- ], // Warns about unused variables, ignoring rest siblings
77
- "no-useless-catch": ["warn"], // Warns about catch clauses that don't do anything
78
- "no-use-before-define": ["warn"], // Warns about using variables before they are defined
79
- "no-useless-call": ["warn"], // Warns about unnecessary calls to .call() and .apply()
80
- "no-useless-constructor": "warn", // Warns about unnecessary constructor
81
- "no-useless-concat": ["warn"], // Warns about unnecessary string concatenation
82
- "no-useless-computed-key": "warn", // Warns about unnecessary computed property keys
83
- "consistent-this": ["warn", "self"], // Enforces consistent use of `this` with a specific alias
84
- "no-mixed-requires": ["warn", { grouping: true, allowCall: false }], // Enforces consistent use of `import` and `require`
85
- "no-useless-escape": ["warn"], // Warns about unnecessary escape characters
86
- "no-eq-null": "warn", // Warns about comparisons with null using == or !=
87
- "no-useless-return": ["warn"], // Warns about unnecessary return statements
88
- "no-multi-spaces": ["warn"], // Warns about multiple spaces
89
- "no-multiple-empty-lines": [
90
- "warn",
91
- {
92
- max: 1,
93
- maxBOF: 0,
94
- maxEOF: 0,
95
- },
96
- ], // Limits the number of consecutive empty lines
97
- "padding-line-between-statements": [
98
- "warn",
99
- {
100
- blankLine: "always",
101
- next: "return",
102
- prev: "*",
103
- },
104
- {
105
- blankLine: "always",
106
- next: "*",
107
- prev: ["const", "let", "var"],
108
- },
109
- {
110
- blankLine: "any",
111
- next: ["const", "let", "var"],
112
- prev: ["const", "let", "var"],
113
- },
114
- ], // Enforces blank lines between statements
115
- "react/button-has-type": ["warn"], // Ensures buttons have a type attribute
116
- "react/destructuring-assignment": ["warn"], // Enforces destructuring assignment in component props
117
- "react/jsx-boolean-value": ["warn"], // Enforces boolean attributes notation in JSX
118
- "react/jsx-handler-names": ["warn"], // Enforces naming conventions for event handlers
119
- "react/jsx-no-bind": [
120
- "warn",
121
- {
122
- allowArrowFunctions: true,
123
- ignoreRefs: true,
124
- },
125
- ], // Warns about unnecessary bind calls in JSX
126
- "react/jsx-no-useless-fragment": ["warn"], // Warns about unnecessary fragments in JSX
127
- "react/jsx-pascal-case": ["warn"], // Enforces PascalCase for user-defined JSX components
128
- "react/jsx-sort-props": [
129
- "warn",
130
- {
131
- callbacksLast: true,
132
- ignoreCase: true,
133
- locale: "auto",
134
- multiline: "ignore",
135
- noSortAlphabetically: false,
136
- reservedFirst: true,
137
- shorthandFirst: false,
138
- shorthandLast: false,
139
- },
140
- ], // Enforces a consistent order for props in JSX
141
- "react/no-access-state-in-setstate": ["warn"], // Warns about accessing state in setState
142
- "react/no-arrow-function-lifecycle": ["warn"], // Warns about using arrow functions in lifecycle methods
143
- "react/no-danger": ["warn"], // Warns about the use of dangerouslySetInnerHTML
144
- "react/no-invalid-html-attribute": ["warn"], // Warns about invalid HTML attributes in JSX
145
- "react/no-set-state": ["warn"], // Warns about the use of setState in class components
146
- "react/no-this-in-sfc": ["warn"], // Warns about the use of this in stateless functional components
147
- "react/no-typos": ["warn"], // Warns about typos in component names
148
- "react/no-unused-state": ["warn"], // Warns about unused state variables
149
- "react/display-name": ["off"], // Disables the requirement for a display name in React components
150
- "react/self-closing-comp": ["warn"], // Warns about components that should be self-closing
151
- "react/sort-comp": ["warn"], // Enforces a consistent order for React component methods
152
- "react/style-prop-object": ["warn"], // Warns about using strings for the style prop
153
- "react/void-dom-elements-no-children": ["warn"], // Warns about void DOM elements having children
154
- "typescript-sort-keys/interface": ["warn"], // Warns about unsorted keys in TypeScript interfaces
155
- "typescript-sort-keys/string-enum": ["warn"], // Warns about unsorted keys in TypeScript string enums
156
- yoda: ["warn"], // Enforces a consistent style for Yoda conditions
157
- "react-hooks/exhaustive-deps": ["off"], // Disables the requirement for exhaustive dependencies in React Hooks
158
- "no-var": "error", // Enforces the use of const and let over var
159
- eqeqeq: "warn", // Enforces the use of === and !== over == and !=
160
- "react-hooks/rules-of-hooks": "error", // Enforces the rules of hooks
161
- "react-hooks/exhaustive-deps": "warn", // Warns about missing dependencies in hooks
162
- "@typescript-eslint/explicit-function-return-type": "error", // Requires explicit return types for functions
163
- "prefer-destructuring": ["warn", { array: true, object: true }], // Enforces consistent array and object destructuring
164
- },
165
- settings: {
166
- next: {
167
- rootDir: "./",
168
- },
169
- react: {
170
- version: "detect",
171
- },
172
- },
173
- };