@labeg/code-style 5.3.1 → 5.3.3
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/eslint.config.js +136 -0
- package/package.json +2 -1
package/eslint.config.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// eslint.config.js
|
|
2
|
+
import js from "@eslint/js";
|
|
3
|
+
import tseslint from "typescript-eslint";
|
|
4
|
+
import stylistic from "@stylistic/eslint-plugin";
|
|
5
|
+
import reactPlugin from "eslint-plugin-react";
|
|
6
|
+
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
7
|
+
import globals from "globals";
|
|
8
|
+
|
|
9
|
+
/** @type {import("eslint").Linter.Config} */
|
|
10
|
+
export default tseslint.config(
|
|
11
|
+
{ignores: ["**/node_modules/**", "dist/"]},
|
|
12
|
+
{
|
|
13
|
+
files: ["**/*.{js}"],
|
|
14
|
+
extends: [js.configs.all]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
files: ["**/*.{ts}"], // ,tsx
|
|
18
|
+
extends: [
|
|
19
|
+
js.configs.all,
|
|
20
|
+
tseslint.configs.all
|
|
21
|
+
],
|
|
22
|
+
rules: {
|
|
23
|
+
"@typescript-eslint/no-inferrable-types": "off", // Need for reflection
|
|
24
|
+
"@typescript-eslint/no-magic-numbers": "off",
|
|
25
|
+
"@typescript-eslint/prefer-readonly-parameter-types": "off", // Wrong immutable undestand
|
|
26
|
+
"@typescript-eslint/no-floating-promises": "off", // Block async promises
|
|
27
|
+
"@typescript-eslint/no-extra-parens": "off", // Conflict with react best practise in jsx
|
|
28
|
+
"@typescript-eslint/promise-function-async": "off", // More nice
|
|
29
|
+
"@typescript-eslint/no-misused-promises": ["error", {checksVoidReturn: false}], // More nice
|
|
30
|
+
"@typescript-eslint/naming-convention": "off", // Bad with react func components
|
|
31
|
+
"@typescript-eslint/no-confusing-void-expression": "off", // More nice
|
|
32
|
+
"@typescript-eslint/member-ordering": "off" // Need correct priority
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
extends: [stylistic.configs["all-flat"]],
|
|
37
|
+
rules: {
|
|
38
|
+
// Stylistic rules
|
|
39
|
+
"@stylistic/max-len": [
|
|
40
|
+
"error", {
|
|
41
|
+
code: 140,
|
|
42
|
+
comments: 140
|
|
43
|
+
}
|
|
44
|
+
], // More nice, for modern screens
|
|
45
|
+
"@stylistic/padded-blocks": [
|
|
46
|
+
"error", {
|
|
47
|
+
classes: "always",
|
|
48
|
+
blocks: "never",
|
|
49
|
+
switches: "never"
|
|
50
|
+
}
|
|
51
|
+
], // More nice
|
|
52
|
+
"@stylistic/function-call-argument-newline": ["error", "consistent"], // More nice
|
|
53
|
+
"@stylistic/quote-props": ["error", "as-needed"], // More nice
|
|
54
|
+
"@stylistic/multiline-ternary": ["error", "always-multiline"], // More nice
|
|
55
|
+
"@stylistic/array-element-newline": ["error", "consistent"], // More nice
|
|
56
|
+
"@stylistic/operator-linebreak": ["error", "after"], // More nice
|
|
57
|
+
"@stylistic/no-extra-parens": "off",
|
|
58
|
+
"@stylistic/dot-location": ["error", "property"] // Maybe later?
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
files: ["**/*.{jsx,tsx}"],
|
|
63
|
+
extends: [reactPlugin.configs.flat.all],
|
|
64
|
+
settings: {
|
|
65
|
+
react: {
|
|
66
|
+
version: "detect"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
rules: {
|
|
70
|
+
"react/jsx-filename-extension": ["error", {extensions: [".jsx", ".tsx"]}], // Added typescript file extension
|
|
71
|
+
"react/jsx-no-literals": "off", // Broken rule, not work with ??
|
|
72
|
+
"react/jsx-max-depth": ["error", {max: 10}], // To small by default
|
|
73
|
+
"react/function-component-definition": ["error", {namedComponents: "arrow-function"}], // Same as eslint func-styles
|
|
74
|
+
"react/forbid-component-props": "off", // Conflict with styled-components
|
|
75
|
+
"react/require-default-props": "off", // Don't used in modern react
|
|
76
|
+
"react/jsx-uses-react": "off", // https://ru.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
|
|
77
|
+
"react/react-in-jsx-scope": "off" // https://ru.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
extends: [jsxA11y.flatConfigs.strict],
|
|
82
|
+
rules: {
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
languageOptions: {
|
|
88
|
+
ecmaVersion: 2024,
|
|
89
|
+
sourceType: "module",
|
|
90
|
+
globals: {
|
|
91
|
+
...globals.browser,
|
|
92
|
+
...globals.node
|
|
93
|
+
},
|
|
94
|
+
parserOptions: {
|
|
95
|
+
projectService: true,
|
|
96
|
+
tsconfigRootDir: import.meta.dirname,
|
|
97
|
+
ecmaVersion: "latest",
|
|
98
|
+
ecmaFeatures: {
|
|
99
|
+
jsx: true
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
rules: {
|
|
104
|
+
// Eslint rules
|
|
105
|
+
"sort-imports": "off", // Need found sorter
|
|
106
|
+
"sort-keys": "off", // More nice
|
|
107
|
+
"one-var": ["error", "never"], // More nice
|
|
108
|
+
"no-ternary": "off", // More nice
|
|
109
|
+
"no-void": "off", // Strange rule
|
|
110
|
+
"no-bitwise": "off", // Used in many projects
|
|
111
|
+
"no-inline-comments": "off", // Maybe later?
|
|
112
|
+
"line-comment-position": "off", // Maybe later?
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
// Eslint moved to Stylistic, but now to buggy for js. Remove after fix bugs in new versions Stylistic
|
|
116
|
+
"max-len": [
|
|
117
|
+
"error", {
|
|
118
|
+
code: 140,
|
|
119
|
+
comments: 140
|
|
120
|
+
}
|
|
121
|
+
], // More nice, for modern screens
|
|
122
|
+
"padded-blocks": [
|
|
123
|
+
"error", {
|
|
124
|
+
classes: "always",
|
|
125
|
+
blocks: "never",
|
|
126
|
+
switches: "never"
|
|
127
|
+
}
|
|
128
|
+
], // More nice
|
|
129
|
+
"function-call-argument-newline": ["error", "consistent"], // More nice
|
|
130
|
+
"quote-props": ["error", "as-needed"], // More nice
|
|
131
|
+
"multiline-ternary": ["error", "always-multiline"], // More nice
|
|
132
|
+
"array-element-newline": ["error", "consistent"], // More nice
|
|
133
|
+
"operator-linebreak": ["error", "after"] // More nice
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
);
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labeg/code-style",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.3",
|
|
4
4
|
"author": "Eugene Labutin",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/LabEG/code-style#readme",
|
|
7
7
|
"description": "Code styles rules for difference linters, for create best code quality",
|
|
8
8
|
"type": "module",
|
|
9
|
+
"main": "eslint.config.js",
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
11
12
|
"url": "git+https://github.com/LabEG/code-style.git"
|