@dozalex/lint 0.0.1

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 ADDED
@@ -0,0 +1,8 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 0.0.1 (2026-01-11)
7
+
8
+ **Note:** Version bump only for package @dozalex/lint
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Alex Dozmorov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,55 @@
1
+ # @dozalex/lint/eslint
2
+
3
+ Provides [ESLint](https://eslint.org/) configuration.
4
+
5
+ ## Installation
6
+
7
+ To use this config, install this packages as a development dependency of your project:
8
+
9
+ ### Yarn
10
+
11
+ ```shell
12
+ yarn add --dev @dozalex/lint eslint
13
+ ```
14
+
15
+ ### NPM
16
+
17
+ ```shell
18
+ npm install @dozalex/lint eslint
19
+ ```
20
+
21
+ ## Configuration
22
+
23
+ Create a `eslint.config.mjs` file in the root of your project directory (it should live where `package.json` does).
24
+
25
+ Your `eslint.config.mjs` file should look like this:
26
+
27
+ ```js
28
+ import react from '@dozalex/lint/eslint/react';
29
+ import webpack from '@dozalex/lint/eslint/webpack';
30
+
31
+ export default [...react, ...webpack];
32
+ ```
33
+
34
+ Separate modules help to include only required config rules.
35
+
36
+ Some formatting rules have been skipped in favor of Prettier.
37
+
38
+ ## Usage
39
+
40
+ Add this command to `scripts` of root package.json:
41
+
42
+ ```
43
+ "lint:eslint": "eslint . --fix",
44
+ ```
45
+
46
+ Add this command to `lint-staged` of root package.json:
47
+
48
+ ```
49
+ "*.{js,jsx,ts,tsx,mjs,cjs}": ["eslint --fix --quiet"],
50
+ ```
51
+
52
+ ## Contribution
53
+
54
+ Avoid using "recommended" configurations from plugins as they contain outdated recommendations or formatting rules (trust Prettier).
55
+ Just copy the rules you need.
@@ -0,0 +1,24 @@
1
+ import globals from 'globals';
2
+
3
+ import coreConfig from './core/index.mjs';
4
+ import tsConfig from './typescript.mjs';
5
+
6
+ export default [
7
+ ...coreConfig,
8
+ ...tsConfig,
9
+ {
10
+ files: ['**/*.{ts,tsx,js,mjs}'],
11
+ languageOptions: {
12
+ ecmaVersion: 'latest',
13
+ sourceType: 'module',
14
+ parserOptions: {
15
+ projectService: true,
16
+ ecmaFeatures: { jsx: true },
17
+ },
18
+ globals: {
19
+ ...globals.browser,
20
+ ...globals.node,
21
+ },
22
+ },
23
+ },
24
+ ];
@@ -0,0 +1,138 @@
1
+ export default [
2
+ {
3
+ rules: {
4
+ 'array-callback-return': 'error',
5
+ 'consistent-return': 'error',
6
+ 'default-case': ['error', { commentPattern: '^no default$' }],
7
+ 'default-case-last': 'error',
8
+ 'default-param-last': 'error',
9
+ 'dot-notation': ['error', { allowKeywords: true }],
10
+ 'dot-location': ['error', 'property'],
11
+ eqeqeq: ['error', 'always', { null: 'ignore' }],
12
+ 'grouped-accessor-pairs': 'error',
13
+ 'guard-for-in': 'error',
14
+ 'max-classes-per-file': ['error', 1],
15
+ 'no-alert': 'error',
16
+ 'no-case-declarations': 'error',
17
+ 'no-constant-binary-expression': 'error',
18
+ 'no-constructor-return': 'error',
19
+ 'no-else-return': ['error', { allowElseIf: false }],
20
+ 'no-empty': 'error',
21
+ 'no-empty-function': [
22
+ 'error',
23
+ {
24
+ allow: ['arrowFunctions', 'functions', 'methods'],
25
+ },
26
+ ],
27
+ 'no-empty-pattern': 'error',
28
+ 'no-empty-static-block': 'error',
29
+ 'no-eval': 'error',
30
+ 'no-ex-assign': 'error',
31
+ 'no-extend-native': 'error',
32
+ 'no-extra-bind': 'error',
33
+ 'no-extra-label': 'error',
34
+ 'no-fallthrough': 'error',
35
+ 'no-global-assign': 'error',
36
+ 'no-implied-eval': 'error',
37
+ 'no-irregular-whitespace': 'error',
38
+ 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
39
+ 'no-lone-blocks': 'error',
40
+ 'no-loop-func': 'error',
41
+ 'no-new': 'error',
42
+ 'no-new-func': 'error',
43
+ 'no-new-native-nonconstructor': 'error',
44
+ 'no-new-wrappers': 'error',
45
+ 'no-nonoctal-decimal-escape': 'error',
46
+ 'no-octal': 'error',
47
+ 'no-param-reassign': [
48
+ 'error',
49
+ {
50
+ props: true,
51
+ ignorePropertyModificationsFor: ['acc', 'draft', 'prev'],
52
+ },
53
+ ],
54
+ 'no-regex-spaces': 'error',
55
+ 'no-restricted-properties': [
56
+ 'error',
57
+ {
58
+ object: 'arguments',
59
+ property: 'callee',
60
+ message: 'arguments.callee is deprecated',
61
+ },
62
+ {
63
+ object: 'global',
64
+ property: 'isFinite',
65
+ message: 'Please use Number.isFinite instead',
66
+ },
67
+ {
68
+ object: 'self',
69
+ property: 'isFinite',
70
+ message: 'Please use Number.isFinite instead',
71
+ },
72
+ {
73
+ object: 'window',
74
+ property: 'isFinite',
75
+ message: 'Please use Number.isFinite instead',
76
+ },
77
+ {
78
+ object: 'global',
79
+ property: 'isNaN',
80
+ message: 'Please use Number.isNaN instead',
81
+ },
82
+ {
83
+ object: 'self',
84
+ property: 'isNaN',
85
+ message: 'Please use Number.isNaN instead',
86
+ },
87
+ {
88
+ object: 'window',
89
+ property: 'isNaN',
90
+ message: 'Please use Number.isNaN instead',
91
+ },
92
+ {
93
+ property: '__defineGetter__',
94
+ message: 'Please use Object.defineProperty instead.',
95
+ },
96
+ {
97
+ property: '__defineSetter__',
98
+ message: 'Please use Object.defineProperty instead.',
99
+ },
100
+ {
101
+ object: 'Math',
102
+ property: 'pow',
103
+ message: 'Use the exponentiation operator (**) instead.',
104
+ },
105
+ ],
106
+ 'no-return-assign': ['error', 'always'],
107
+ 'no-return-await': 'error',
108
+ 'no-script-url': 'error',
109
+ 'no-self-assign': ['error', { props: true }],
110
+ 'no-self-compare': 'error',
111
+ 'no-sequences': 'error',
112
+ 'no-throw-literal': 'error',
113
+ 'no-unexpected-multiline': 'error',
114
+ 'no-unused-expressions': [
115
+ 'error',
116
+ {
117
+ allowShortCircuit: false,
118
+ allowTernary: false,
119
+ allowTaggedTemplates: false,
120
+ },
121
+ ],
122
+ 'no-unused-labels': 'error',
123
+ 'no-unused-private-class-members': 'error',
124
+ 'no-useless-assignment': 'error',
125
+ 'no-useless-catch': 'error',
126
+ 'no-useless-concat': 'error',
127
+ 'no-useless-escape': 'error',
128
+ 'no-useless-return': 'error',
129
+ 'no-void': 'error',
130
+ 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
131
+ 'prefer-object-has-own': 'error',
132
+ 'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
133
+ 'preserve-caught-error': 'error',
134
+ radix: 'error',
135
+ yoda: 'error',
136
+ },
137
+ },
138
+ ];
@@ -0,0 +1,51 @@
1
+ export default [
2
+ {
3
+ rules: {
4
+ 'for-direction': 'error',
5
+ 'getter-return': ['error', { allowImplicit: true }],
6
+ 'no-async-promise-executor': 'error',
7
+ 'no-compare-neg-zero': 'error',
8
+ 'no-cond-assign': ['error', 'always'],
9
+ 'no-console': [
10
+ 'error',
11
+ {
12
+ allow: ['warn', 'error', 'info'],
13
+ },
14
+ ],
15
+ 'no-constant-condition': 'warn',
16
+ 'no-control-regex': 'error',
17
+ 'no-debugger': 'error',
18
+ 'no-dupe-args': 'error',
19
+ 'no-dupe-else-if': 'error',
20
+ 'no-dupe-keys': 'error',
21
+ 'no-duplicate-case': 'error',
22
+ 'no-empty': 'error',
23
+ 'no-empty-character-class': 'error',
24
+ 'no-ex-assign': 'error',
25
+ 'no-extra-boolean-cast': 'error',
26
+ 'no-func-assign': 'error',
27
+ 'no-import-assign': 'error',
28
+ 'no-inner-declarations': 'error',
29
+ 'no-invalid-regexp': 'error',
30
+ 'no-loss-of-precision': 'error',
31
+ 'no-misleading-character-class': 'error',
32
+ 'no-obj-calls': 'error',
33
+ 'no-promise-executor-return': 'error',
34
+ 'no-prototype-builtins': 'error',
35
+ 'no-setter-return': 'error',
36
+ 'no-sparse-arrays': 'error',
37
+ 'no-template-curly-in-string': 'error',
38
+ 'no-unreachable': 'error',
39
+ 'no-unreachable-loop': 'error',
40
+ 'no-unsafe-finally': 'error',
41
+ 'no-unsafe-negation': 'error',
42
+ 'no-unsafe-optional-chaining': [
43
+ 'error',
44
+ { disallowArithmeticOperators: true },
45
+ ],
46
+ 'no-useless-backreference': 'error',
47
+ 'use-isnan': 'error',
48
+ 'valid-typeof': ['error', { requireStringLiterals: true }],
49
+ },
50
+ },
51
+ ];
@@ -0,0 +1,66 @@
1
+ export default [
2
+ {
3
+ rules: {
4
+ 'constructor-super': 'error',
5
+ 'no-class-assign': 'error',
6
+ 'no-const-assign': 'error',
7
+ 'no-dupe-class-members': 'error',
8
+ 'no-new-symbol': 'error',
9
+ 'no-this-before-super': 'error',
10
+ 'no-useless-computed-key': 'error',
11
+ 'no-useless-rename': [
12
+ 'error',
13
+ {
14
+ ignoreDestructuring: false,
15
+ ignoreImport: false,
16
+ ignoreExport: false,
17
+ },
18
+ ],
19
+ 'no-var': 'error',
20
+ 'object-shorthand': [
21
+ 'error',
22
+ 'always',
23
+ {
24
+ ignoreConstructors: false,
25
+ avoidQuotes: true,
26
+ },
27
+ ],
28
+ 'prefer-arrow-callback': [
29
+ 'error',
30
+ {
31
+ allowNamedFunctions: false,
32
+ allowUnboundThis: true,
33
+ },
34
+ ],
35
+ 'prefer-const': [
36
+ 'error',
37
+ {
38
+ destructuring: 'any',
39
+ ignoreReadBeforeAssign: true,
40
+ },
41
+ ],
42
+ 'prefer-destructuring': [
43
+ 'error',
44
+ {
45
+ VariableDeclarator: {
46
+ array: false,
47
+ object: true,
48
+ },
49
+ AssignmentExpression: {
50
+ array: true,
51
+ object: false,
52
+ },
53
+ },
54
+ {
55
+ enforceForRenamedProperties: false,
56
+ },
57
+ ],
58
+ 'prefer-numeric-literals': 'error',
59
+ 'prefer-rest-params': 'error',
60
+ 'prefer-spread': 'error',
61
+ 'prefer-template': 'error',
62
+ 'require-yield': 'error',
63
+ 'symbol-description': 'error',
64
+ },
65
+ },
66
+ ];
@@ -0,0 +1,52 @@
1
+ import importPlugin from 'eslint-plugin-import';
2
+
3
+ export default [
4
+ {
5
+ plugins: {
6
+ import: importPlugin,
7
+ },
8
+ settings: {
9
+ 'import/resolver': {
10
+ node: {
11
+ extensions: ['.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
12
+ },
13
+ },
14
+ 'import/ignore': ['node_modules', '\\.(scss|css|less|svg|json)$'],
15
+ },
16
+ rules: {
17
+ 'import/named': 'error',
18
+ 'import/export': 'error',
19
+ 'import/no-named-as-default': 'error',
20
+ 'import/no-named-as-default-member': 'error',
21
+ 'import/no-extraneous-dependencies': [
22
+ 'error',
23
+ {
24
+ devDependencies: [
25
+ '**/test/**',
26
+ '**/tests/**',
27
+ '**/*.{test,spec}.ts',
28
+ '**/*.config.{ts,js,mjs,mts}',
29
+ ],
30
+ optionalDependencies: false,
31
+ },
32
+ ],
33
+ 'import/no-mutable-exports': 'error',
34
+ 'import/first': 'error',
35
+ 'import/no-duplicates': 'error',
36
+ 'import/order': [
37
+ 'error',
38
+ { groups: [['builtin', 'external', 'internal']] },
39
+ ],
40
+ 'import/newline-after-import': 'error',
41
+ 'import/no-absolute-path': 'error',
42
+ 'import/no-dynamic-require': 'error',
43
+ 'import/no-webpack-loader-syntax': 'error',
44
+ 'import/no-named-default': 'error',
45
+ 'import/no-self-import': 'error',
46
+ 'import/no-cycle': ['error', { maxDepth: Infinity }],
47
+ 'import/no-useless-path-segments': ['error', { commonjs: true }],
48
+ 'import/no-import-module-exports': 'error',
49
+ 'import/no-relative-packages': 'error',
50
+ },
51
+ },
52
+ ];
@@ -0,0 +1,17 @@
1
+ import bestPractices from './best-practices.mjs';
2
+ import errorsPractices from './errors.mjs';
3
+ import es6 from './es6.mjs';
4
+ import imports from './imports.mjs';
5
+ import node from './node.mjs';
6
+ import variables from './variables.mjs';
7
+ import style from './style.mjs';
8
+
9
+ export default [
10
+ ...bestPractices,
11
+ ...errorsPractices,
12
+ ...node,
13
+ ...style,
14
+ ...variables,
15
+ ...es6,
16
+ ...imports,
17
+ ];
@@ -0,0 +1,9 @@
1
+ export default [
2
+ {
3
+ rules: {
4
+ 'no-new-require': 'error',
5
+ 'no-buffer-constructor': 'error',
6
+ 'no-path-concat': 'error',
7
+ },
8
+ },
9
+ ];
@@ -0,0 +1,52 @@
1
+ export default [
2
+ {
3
+ rules: {
4
+ 'arrow-body-style': ['warn', 'as-needed'],
5
+ camelcase: [
6
+ 'error',
7
+ {
8
+ properties: 'never',
9
+ ignoreDestructuring: true,
10
+ ignoreGlobals: true,
11
+ ignoreImports: true,
12
+ },
13
+ ],
14
+ 'new-cap': [
15
+ 'error',
16
+ {
17
+ newIsCap: true,
18
+ capIsNew: false,
19
+ capIsNewExceptions: [
20
+ 'Immutable.Map',
21
+ 'Immutable.Set',
22
+ 'Immutable.List',
23
+ ],
24
+ },
25
+ ],
26
+ 'no-array-constructor': 'error',
27
+ 'no-multi-assign': ['error'],
28
+ 'no-nested-ternary': 'error',
29
+ 'no-object-constructor': 'error',
30
+ 'no-restricted-syntax': [
31
+ 'error',
32
+ {
33
+ selector: 'ForInStatement',
34
+ message:
35
+ 'for..in iterates over the entire prototype chain. Use Object.{keys,values,entries} or for..of.',
36
+ },
37
+ {
38
+ selector: 'LabeledStatement',
39
+ message:
40
+ 'Labels are a form of GOTO; using them makes code confusing.',
41
+ },
42
+ ],
43
+ 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
44
+ 'one-var': ['error', 'never'],
45
+ 'operator-assignment': ['error', 'always'],
46
+ 'prefer-exponentiation-operator': 'error',
47
+ 'prefer-object-spread': 'error',
48
+ 'spaced-comment': 'warn',
49
+ 'unicode-bom': ['error', 'never'],
50
+ },
51
+ },
52
+ ];
@@ -0,0 +1,14 @@
1
+ export default [
2
+ {
3
+ rules: {
4
+ 'block-scoped-var': 'error',
5
+ 'no-shadow-restricted-names': 'error',
6
+ 'no-unassigned-vars': 'error',
7
+ 'no-undef-init': 'error',
8
+ 'no-use-before-define': [
9
+ 'error',
10
+ { functions: true, classes: true, variables: true },
11
+ ],
12
+ },
13
+ },
14
+ ];
@@ -0,0 +1,13 @@
1
+ import baseConfig from './base.mjs';
2
+ import a11yConfig from './reactBase/a11y.mjs';
3
+ import reactBestPracticesConfig from './reactBase/best-practices.mjs';
4
+ import hooksConfig from './reactBase/hooks.mjs';
5
+ import orderConfig from './reactBase/order.mjs';
6
+
7
+ export default [
8
+ ...baseConfig,
9
+ ...a11yConfig,
10
+ ...reactBestPracticesConfig,
11
+ ...hooksConfig,
12
+ ...orderConfig,
13
+ ];
@@ -0,0 +1,93 @@
1
+ import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
2
+
3
+ export default [
4
+ {
5
+ plugins: {
6
+ 'jsx-a11y': jsxA11yPlugin,
7
+ },
8
+ rules: {
9
+ 'jsx-a11y/alt-text': 'error',
10
+ 'jsx-a11y/anchor-has-content': 'error',
11
+ 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
12
+ 'jsx-a11y/aria-props': 'error',
13
+ 'jsx-a11y/aria-proptypes': 'error',
14
+ 'jsx-a11y/aria-role': 'error',
15
+ 'jsx-a11y/aria-unsupported-elements': 'error',
16
+ 'jsx-a11y/autocomplete-valid': 'error',
17
+ 'jsx-a11y/heading-has-content': 'error',
18
+ 'jsx-a11y/iframe-has-title': 'error',
19
+ 'jsx-a11y/img-redundant-alt': 'error',
20
+ 'jsx-a11y/interactive-supports-focus': [
21
+ 'error',
22
+ {
23
+ tabbable: [
24
+ 'button',
25
+ 'checkbox',
26
+ 'link',
27
+ 'searchbox',
28
+ 'spinbutton',
29
+ 'switch',
30
+ 'textbox',
31
+ ],
32
+ },
33
+ ],
34
+ 'jsx-a11y/label-has-associated-control': ['error', { assert: 'either' }],
35
+ 'jsx-a11y/media-has-caption': 'error',
36
+ 'jsx-a11y/no-interactive-element-to-noninteractive-role': [
37
+ 'error',
38
+ {
39
+ tr: ['none', 'presentation'],
40
+ canvas: ['img'],
41
+ },
42
+ ],
43
+ 'jsx-a11y/no-noninteractive-element-to-interactive-role': [
44
+ 'error',
45
+ {
46
+ ul: [
47
+ 'listbox',
48
+ 'menu',
49
+ 'menubar',
50
+ 'radiogroup',
51
+ 'tablist',
52
+ 'tree',
53
+ 'treegrid',
54
+ ],
55
+ ol: [
56
+ 'listbox',
57
+ 'menu',
58
+ 'menubar',
59
+ 'radiogroup',
60
+ 'tablist',
61
+ 'tree',
62
+ 'treegrid',
63
+ ],
64
+ li: [
65
+ 'menuitem',
66
+ 'menuitemradio',
67
+ 'menuitemcheckbox',
68
+ 'option',
69
+ 'row',
70
+ 'tab',
71
+ 'treeitem',
72
+ ],
73
+ table: ['grid'],
74
+ td: ['gridcell'],
75
+ fieldset: ['radiogroup', 'presentation'],
76
+ },
77
+ ],
78
+ 'jsx-a11y/no-noninteractive-tabindex': [
79
+ 'error',
80
+ {
81
+ tags: [],
82
+ roles: ['tabpanel'],
83
+ allowExpressionValues: true,
84
+ },
85
+ ],
86
+ 'jsx-a11y/no-redundant-roles': 'error',
87
+ 'jsx-a11y/role-has-required-aria-props': 'error',
88
+ 'jsx-a11y/role-supports-aria-props': 'error',
89
+ 'jsx-a11y/scope': 'error',
90
+ 'jsx-a11y/tabindex-no-positive': 'error',
91
+ },
92
+ },
93
+ ];
@@ -0,0 +1,55 @@
1
+ import reactPlugin from 'eslint-plugin-react';
2
+
3
+ export default [
4
+ {
5
+ plugins: {
6
+ react: reactPlugin,
7
+ },
8
+ settings: {
9
+ react: {
10
+ version: 'detect',
11
+ },
12
+ },
13
+ rules: {
14
+ 'react/jsx-boolean-value': ['error', 'never'],
15
+ 'react/jsx-key': 'error',
16
+ 'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
17
+ 'react/jsx-pascal-case': ['error', { allowAllCaps: true }],
18
+ 'react/no-danger': 'warn',
19
+ 'react/no-deprecated': ['error'],
20
+ 'react/no-unknown-property': 'error',
21
+ 'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
22
+ 'react/jsx-no-comment-textnodes': 'error',
23
+ 'react/no-danger-with-children': 'error',
24
+ 'react/style-prop-object': 'error',
25
+ 'react/no-children-prop': 'error',
26
+ 'react/no-array-index-key': 'warn',
27
+ 'react/void-dom-elements-no-children': 'error',
28
+ 'react/button-has-type': [
29
+ 'error',
30
+ {
31
+ button: true,
32
+ submit: true,
33
+ reset: false,
34
+ },
35
+ ],
36
+ 'react/jsx-no-script-url': [
37
+ 'error',
38
+ [
39
+ {
40
+ name: 'Link',
41
+ props: ['to'],
42
+ },
43
+ ],
44
+ ],
45
+ 'react/jsx-no-useless-fragment': 'error',
46
+ 'react/function-component-definition': [
47
+ 'error',
48
+ { namedComponents: 'arrow-function' },
49
+ ],
50
+ 'react/jsx-no-constructed-context-values': 'error',
51
+ 'react/no-unstable-nested-components': 'error',
52
+ 'react/no-invalid-html-attribute': 'error',
53
+ },
54
+ },
55
+ ];
@@ -0,0 +1,13 @@
1
+ import reactHooksPlugin from 'eslint-plugin-react-hooks';
2
+
3
+ export default [
4
+ {
5
+ plugins: {
6
+ 'react-hooks': reactHooksPlugin,
7
+ },
8
+ rules: {
9
+ 'react-hooks/rules-of-hooks': 'error',
10
+ 'react-hooks/exhaustive-deps': 'error',
11
+ },
12
+ },
13
+ ];
@@ -0,0 +1,50 @@
1
+ export default [
2
+ {
3
+ rules: {
4
+ 'import/order': [
5
+ 2,
6
+ {
7
+ groups: [
8
+ ['builtin', 'external'],
9
+ 'unknown',
10
+ 'internal',
11
+ 'parent',
12
+ ['sibling', 'index'],
13
+ ],
14
+ pathGroups: [
15
+ // Order main external deps to do a code more clear.
16
+ // With this order developer can focus only for specific deps.
17
+ {
18
+ pattern: 'react/**',
19
+ patternOptions: {
20
+ partial: true,
21
+ },
22
+ group: 'external',
23
+ position: 'before',
24
+ },
25
+ {
26
+ pattern: 'react-redux/**',
27
+ patternOptions: {
28
+ partial: true,
29
+ },
30
+ group: 'external',
31
+ position: 'before',
32
+ },
33
+ {
34
+ pattern: '@/**',
35
+ group: 'internal',
36
+ position: 'before',
37
+ },
38
+ ],
39
+ pathGroupsExcludedImportTypes: [],
40
+ 'newlines-between': 'always',
41
+ distinctGroup: false,
42
+ alphabetize: {
43
+ order: 'asc',
44
+ caseInsensitive: true,
45
+ },
46
+ },
47
+ ],
48
+ },
49
+ },
50
+ ];
@@ -0,0 +1,42 @@
1
+ import tsEslintPlugin from '@typescript-eslint/eslint-plugin';
2
+ import tsParser from '@typescript-eslint/parser';
3
+
4
+ export default [
5
+ {
6
+ plugins: {
7
+ '@typescript-eslint': tsEslintPlugin,
8
+ },
9
+ languageOptions: {
10
+ parser: tsParser,
11
+ },
12
+ settings: {
13
+ 'import/resolver': {
14
+ typescript: {
15
+ project: './tsconfig.json',
16
+ },
17
+ },
18
+ },
19
+ rules: {
20
+ '@typescript-eslint/no-empty-function': 0,
21
+ '@typescript-eslint/no-use-before-define': 'error',
22
+ '@typescript-eslint/no-non-null-assertion': 0,
23
+ '@typescript-eslint/no-explicit-any': 'error',
24
+ '@typescript-eslint/no-unnecessary-condition': ['error'],
25
+ '@typescript-eslint/no-shadow': [
26
+ 'error',
27
+ {
28
+ ignoreTypeValueShadow: true,
29
+ ignoreFunctionTypeParameterNameValueShadow: true,
30
+ },
31
+ ],
32
+ '@typescript-eslint/no-unused-vars': [
33
+ 'error',
34
+ {
35
+ argsIgnorePattern: '^_',
36
+ varsIgnorePattern: '^_',
37
+ caughtErrorsIgnorePattern: '^_',
38
+ },
39
+ ],
40
+ },
41
+ },
42
+ ];
@@ -0,0 +1,11 @@
1
+ export default [
2
+ {
3
+ settings: {
4
+ 'import/resolver': {
5
+ webpack: {
6
+ config: 'webpack.config.ts',
7
+ },
8
+ },
9
+ },
10
+ },
11
+ ];
@@ -0,0 +1,53 @@
1
+ # @dozalex/lint/madge
2
+
3
+ Provides [Madge](https://github.com/pahen/madge) configuration.
4
+
5
+ ## Installation
6
+
7
+ To use this config, install this packages as a development dependency of your project:
8
+
9
+ ### Yarn
10
+
11
+ ```shell
12
+ yarn add --dev madge husky
13
+ ```
14
+
15
+ ### NPM
16
+
17
+ ```shell
18
+ npm install madge husky --save-dev
19
+ ```
20
+
21
+ ## Configuration
22
+
23
+ Create a `.madgerc` file in the root of your project directory (it should live where `package.json` does).
24
+
25
+ Your `.madgerc` file should look like this:
26
+
27
+ ```json
28
+ {
29
+ "detectiveOptions": {
30
+ "ts": {
31
+ "skipTypeImports": true
32
+ }
33
+ },
34
+ "fileExtensions": ["ts", "tsx"],
35
+ "tsConfig": "./tsconfig.json"
36
+ }
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ Add this command to `scripts` of root package.json:
42
+
43
+ ```
44
+ "lint:madge": "madge --circular .",
45
+ ```
46
+
47
+ Add this command to `husky/pre-commit`:
48
+
49
+ ```
50
+ yarn madge --circular .
51
+ ```
52
+
53
+ It's important to use it here to trigger it once for the whole project.
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@dozalex/lint",
3
+ "title": "Lint configs",
4
+ "version": "0.0.1",
5
+ "license": "MIT",
6
+ "author": "Alex Dozmorov",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Dozalex/lint-configs.git",
10
+ "directory": "packages/lint"
11
+ },
12
+ "exports": {
13
+ "./eslint/base": "./eslint/base.mjs",
14
+ "./eslint/core": "./eslint/core/index.mjs",
15
+ "./eslint/react": "./eslint/react.mjs",
16
+ "./eslint/webpack": "./eslint/webpack.mjs",
17
+ "./*": "./*"
18
+ },
19
+ "engines": {
20
+ "node": ">=22.13.0"
21
+ },
22
+ "peerDependencies": {
23
+ "eslint": "^9.35.0",
24
+ "prettier": "^3.0.0",
25
+ "stylelint": "^16.0.0",
26
+ "typescript": "^5.7.0"
27
+ },
28
+ "dependencies": {
29
+ "@eslint/js": "^9.39.2",
30
+ "@typescript-eslint/eslint-plugin": "^8.52.0",
31
+ "@typescript-eslint/parser": "^8.52.0",
32
+ "eslint-import-resolver-typescript": "^4.4.4",
33
+ "eslint-import-resolver-webpack": "^0.13.10",
34
+ "eslint-plugin-import": "^2.32.0",
35
+ "eslint-plugin-jsx-a11y": "^6.10.2",
36
+ "eslint-plugin-react": "^7.37.5",
37
+ "eslint-plugin-react-hooks": "^7.0.1",
38
+ "globals": "^17.0.0",
39
+ "postcss-styled-syntax": "^0.7.1",
40
+ "stylelint-order": "^7.0.1"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "gitHead": "1684bbf8dd0c615fbf0f64ec29fad353be381beb"
46
+ }
@@ -0,0 +1,47 @@
1
+ # @dozalex/lint/prettier
2
+
3
+ Provides [Prettier](https://prettier.io/) configuration.
4
+
5
+ ## Installation
6
+
7
+ To use this config, install this packages as a development dependency of your project:
8
+
9
+ ### Yarn
10
+
11
+ ```shell
12
+ yarn add --dev @dozalex/lint prettier
13
+ ```
14
+
15
+ ### NPM
16
+
17
+ ```shell
18
+ npm install @dozalex/lint prettier --save-dev
19
+ ```
20
+
21
+ ## Configuration
22
+
23
+ Create a `.prettierrc` file in the root of your project directory (it should live where `package.json` does):
24
+
25
+ ```
26
+ "@dozalex/lint/prettier"
27
+ ```
28
+
29
+ Create (if required) a `.prettierignore` file in the root of your project directory (it should live where `package.json` does):
30
+
31
+ ```
32
+ **/ignoreThisFile.js
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ Add this commands to `scripts` of root package.json:
38
+
39
+ ```
40
+ "lint:prettier": "prettier . -w --log-level error --ignore-unknown",
41
+ ```
42
+
43
+ Add this rule to the end of `lint-staged` of root package.json:
44
+
45
+ ```
46
+ "*": ["prettier -w --log-level error --ignore-unknown"]
47
+ ```
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ arrowParens: 'avoid',
3
+ bracketSpacing: true,
4
+ endOfLine: 'lf',
5
+ jsxSingleQuote: true,
6
+ printWidth: 80,
7
+ quoteProps: 'as-needed',
8
+ semi: true,
9
+ singleQuote: true,
10
+ tabWidth: 2,
11
+ trailingComma: 'all',
12
+ useTabs: false,
13
+ };
@@ -0,0 +1,55 @@
1
+ # @dozalex/lint/stylelint
2
+
3
+ Provides [Stylelint](https://stylelint.io/) configuration.
4
+
5
+ ## Installation
6
+
7
+ To use this config, install this packages as a development dependency of your project:
8
+
9
+ ### Yarn
10
+
11
+ ```shell
12
+ yarn add --dev @dozalex/lint stylelint
13
+ ```
14
+
15
+ ### NPM
16
+
17
+ ```shell
18
+ npm install @dozalex/lint stylelint --save-dev
19
+ ```
20
+
21
+ ## Configuration
22
+
23
+ Create a `stylelint.config.js` file in the root of your project directory (it should live where `package.json` does):
24
+
25
+ ```js
26
+ module.exports = {
27
+ extends: ['./node_modules/@dozalex/lint/stylelint'],
28
+ };
29
+ ```
30
+
31
+ Default value of files pattern is
32
+
33
+ ```js
34
+ files: ['**/*.css'];
35
+ ```
36
+
37
+ Feel free to use your own pattern, e.g.
38
+
39
+ ```js
40
+ files: ['**/*styled.ts'];
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ Add this commands to `scripts` of root package.json (use your own file mask):
46
+
47
+ ```
48
+ "lint:style": "stylelint './**/*.css' --fix",
49
+ ```
50
+
51
+ Add this command to `lint-staged` of root package.json:
52
+
53
+ ```
54
+ "*.{css,ts,tsx}": ["stylelint --fix"],
55
+ ```
@@ -0,0 +1,177 @@
1
+ module.exports = {
2
+ plugins: ['stylelint-order'],
3
+ customSyntax: 'postcss-styled-syntax',
4
+ files: ['**/*.css'],
5
+ rules: {
6
+ 'order/order': ['custom-properties', 'declarations'],
7
+ 'order/properties-order': [
8
+ {
9
+ groupName: 'position',
10
+ emptyLineBefore: 'always',
11
+ noEmptyLineBetween: true,
12
+ properties: ['position', 'top', 'right', 'bottom', 'left', 'z-index'],
13
+ },
14
+ {
15
+ groupName: 'layout',
16
+ emptyLineBefore: 'always',
17
+ noEmptyLineBetween: true,
18
+ properties: [
19
+ 'display',
20
+ 'grid',
21
+ 'grid-template-columns',
22
+ 'grid-template-rows',
23
+ 'grid-template-areas',
24
+ 'grid-template',
25
+ 'gap',
26
+ 'grid-gap',
27
+ 'row-gap',
28
+ 'column-gap',
29
+ 'grid-column-gap',
30
+ 'grid-row-gap',
31
+ 'grid-auto-columns',
32
+ 'grid-auto-rows',
33
+ 'grid-auto-flow',
34
+ 'grid-column-start',
35
+ 'grid-column-end',
36
+ 'grid-row-start',
37
+ 'grid-row-end',
38
+ 'grid-column',
39
+ 'grid-row',
40
+ 'flex',
41
+ 'flex-direction',
42
+ 'flex-flow',
43
+ 'flex-wrap',
44
+ 'place-content',
45
+ 'place-items',
46
+ 'place-self',
47
+ 'align-content',
48
+ 'align-items',
49
+ 'align-self',
50
+ 'justify-content',
51
+ 'justify-items',
52
+ 'justify-self',
53
+ 'flex-grow',
54
+ 'flex-shrink',
55
+ 'order',
56
+ 'float',
57
+ 'clear',
58
+ 'width',
59
+ 'min-width',
60
+ 'max-width',
61
+ 'height',
62
+ 'min-height',
63
+ 'max-height',
64
+ 'padding',
65
+ 'padding-top',
66
+ 'padding-right',
67
+ 'padding-bottom',
68
+ 'padding-left',
69
+ 'margin',
70
+ 'margin-top',
71
+ 'margin-right',
72
+ 'margin-bottom',
73
+ 'margin-left',
74
+ ],
75
+ },
76
+ {
77
+ groupName: 'other',
78
+ emptyLineBefore: 'always',
79
+ noEmptyLineBetween: true,
80
+ properties: [
81
+ 'content',
82
+ 'color',
83
+ 'fill',
84
+ 'stroke',
85
+ 'background',
86
+ 'background-clip',
87
+ 'background-color',
88
+ 'background-position',
89
+ 'background-repeat',
90
+ 'background-size',
91
+ 'border',
92
+ 'border-bottom',
93
+ 'border-bottom-color',
94
+ 'border-bottom-style',
95
+ 'border-bottom-width',
96
+ 'border-color',
97
+ 'border-left',
98
+ 'border-left-color',
99
+ 'border-left-style',
100
+ 'border-left-width',
101
+ 'border-right',
102
+ 'border-right-color',
103
+ 'border-right-style',
104
+ 'border-right-width',
105
+ 'border-style',
106
+ 'border-top',
107
+ 'border-top-color',
108
+ 'border-top-style',
109
+ 'border-top-width',
110
+ 'border-width',
111
+ 'border-radius',
112
+ 'border-top-left-radius',
113
+ 'border-top-right-radius',
114
+ 'border-bottom-left-radius',
115
+ 'border-bottom-right-radius',
116
+ 'box-sizing',
117
+ 'font',
118
+ 'font-family',
119
+ 'font-size',
120
+ 'font-weight',
121
+ 'line-height',
122
+ 'letter-spacing',
123
+ 'font-feature-settings',
124
+ 'list-style',
125
+ 'cursor',
126
+ 'opacity',
127
+ 'outline',
128
+ 'filter',
129
+ 'pointer-events',
130
+ 'object-fit',
131
+ 'overflow',
132
+ 'overflow-x',
133
+ 'overflow-y',
134
+ 'overflow-wrap',
135
+ 'text-overflow',
136
+ 'white-space',
137
+ 'word-break',
138
+ 'word-wrap',
139
+ 'transition',
140
+ 'visibility',
141
+ 'hyphens',
142
+ 'text-align',
143
+ 'text-transform',
144
+ 'text-decoration',
145
+ 'text-underline-offset',
146
+ 'text-indent',
147
+ 'text-justify',
148
+ 'text-shadow',
149
+ 'writing-mode',
150
+ 'box-shadow',
151
+ 'transform',
152
+ 'zoom',
153
+ 'scroll-snap-align',
154
+ '-webkit-box-shadow',
155
+ '-webkit-text-fill-color',
156
+ '-webkit-font-smoothing',
157
+ '-moz-osx-font-smoothing',
158
+ '-webkit-appearance',
159
+ 'animation',
160
+ 'animation-name',
161
+ 'animation-duration',
162
+ 'animation-timing-function',
163
+ 'animation-delay',
164
+ 'animation-iteration-count',
165
+ 'animation-direction',
166
+ 'animation-fill-mode',
167
+ 'animation-play-state',
168
+ 'resize',
169
+ 'page-break-after',
170
+ 'page-break-before',
171
+ 'page-break-inside',
172
+ 'mix-blend-mode',
173
+ ],
174
+ },
175
+ ],
176
+ },
177
+ };