@labeg/code-style 5.1.0 → 5.3.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.
Files changed (2) hide show
  1. package/.eslintrc.js +136 -140
  2. package/package.json +15 -12
package/.eslintrc.js CHANGED
@@ -1,140 +1,136 @@
1
- "use strict"
2
-
3
- /**
4
- * Good instruction:
5
- * https://duncanleung.com/eslint-mixed-javascript-typescript-files-codebase/
6
- */
7
-
8
- const jsAndTsRules = {
9
- // Eslint rules
10
- "sort-imports": "off", // Need found sorter
11
- "sort-keys": "off", // More nice
12
- "one-var": ["error", "never"], // More nice
13
- "no-ternary": "off", // More nice
14
- "no-void": "off", // Strange rule
15
- "no-bitwise": "off", // Used in many projects
16
- "no-inline-comments": "off", // Maybe later?
17
- "line-comment-position": "off", // Maybe later?
18
-
19
-
20
- // Eslint moved to Stylistic, but now to buggy for js. Remove after fix bugs in new versions Stylistic
21
- "max-len": [
22
- "error", {
23
- code: 140,
24
- comments: 140
25
- }
26
- ], // More nice, for modern screens
27
- "padded-blocks": [
28
- "error", {
29
- classes: "always",
30
- blocks: "never",
31
- switches: "never"
32
- }
33
- ], // More nice
34
- "function-call-argument-newline": ["error", "consistent"], // More nice
35
- "quote-props": ["error", "as-needed"], // More nice
36
- "multiline-ternary": ["error", "always-multiline"], // More nice
37
- "array-element-newline": ["error", "consistent"], // More nice
38
- "operator-linebreak": ["error", "after"], // More nice
39
-
40
-
41
- // Stylistic rules
42
- "@stylistic/max-len": [
43
- "error", {
44
- code: 140,
45
- comments: 140
46
- }
47
- ], // More nice, for modern screens
48
- "@stylistic/padded-blocks": [
49
- "error", {
50
- classes: "always",
51
- blocks: "never",
52
- switches: "never"
53
- }
54
- ], // More nice
55
- "@stylistic/function-call-argument-newline": ["error", "consistent"], // More nice
56
- "@stylistic/quote-props": ["error", "as-needed"], // More nice
57
- "@stylistic/multiline-ternary": ["error", "always-multiline"], // More nice
58
- "@stylistic/array-element-newline": ["error", "consistent"], // More nice
59
- "@stylistic/operator-linebreak": ["error", "after"], // More nice
60
- "@stylistic/no-extra-parens": "off",
61
- "@stylistic/dot-location": ["error", "property"] // Maybe later?
62
- };
63
-
64
- module.exports = {
65
- extends: [
66
- "eslint:all", // There is no React because they are used strictly with Typescript.
67
- // "plugin:@stylistic/all-extends" // Bug, begin incorrect formatting, check in new versions
68
- ],
69
- plugins: [
70
- "@stylistic/migrate"
71
- ],
72
- root: true,
73
- env: {
74
- browser: true,
75
- es2022: true,
76
- node: true
77
- },
78
- ignorePatterns: ["node_modules/*"],
79
- rules: {
80
- ...jsAndTsRules
81
- },
82
- overrides: [
83
- {
84
- files: ["**/*.{ts,tsx}"],
85
- settings: {
86
- react: {
87
- version: "detect"
88
- },
89
- "import/parsers": {
90
- "@typescript-eslint/parser": [".ts", ".tsx"]
91
- },
92
- "import/resolver": {
93
- typescript: {
94
- project: "tsconfig.json"
95
- }
96
- }
97
- },
98
- parser: "@typescript-eslint/parser",
99
- parserOptions: {
100
- project: "tsconfig.json",
101
- sourceType: "module",
102
- ecmaVersion: "latest",
103
- ecmaFeatures: {
104
- jsx: true
105
- }
106
- },
107
- extends: [
108
- "eslint:all",
109
- "plugin:@stylistic/all-extends",
110
- "plugin:@typescript-eslint/all",
111
- "plugin:react/all",
112
- "plugin:jsx-a11y/strict"
113
- ],
114
- rules: {
115
- ...jsAndTsRules,
116
- "no-duplicate-imports": "off", // Bug, conflict between TS import and import type
117
-
118
- "@typescript-eslint/no-inferrable-types": "off", // Need for reflection
119
- "@typescript-eslint/no-magic-numbers": "off",
120
- "@typescript-eslint/prefer-readonly-parameter-types": "off", // Wrong immutable undestand
121
- "@typescript-eslint/no-floating-promises": "off", // Block async promises
122
- "@typescript-eslint/no-extra-parens": "off", // Conflict with react best practise in jsx
123
- "@typescript-eslint/promise-function-async": "off", // More nice
124
- "@typescript-eslint/no-misused-promises": ["error", {checksVoidReturn: false}], // More nice
125
- "@typescript-eslint/naming-convention": "off", // Bad with react func components
126
- "@typescript-eslint/no-confusing-void-expression": "off", // More nice
127
- "@typescript-eslint/member-ordering": "off", // Need correct priority
128
-
129
- "react/jsx-filename-extension": ["error", {extensions: [".tsx"]}], // Added typescript file extension
130
- "react/jsx-no-literals": "off", // Broken rule, not work with ??
131
- "react/jsx-max-depth": ["error", {max: 10}], // To small by default
132
- "react/function-component-definition": ["error", {namedComponents: "arrow-function"}], // Same as eslint func-styles
133
- "react/forbid-component-props": "off", // Conflict with styled-components
134
- "react/require-default-props": "off", // Don't used in modern react
135
- "react/jsx-uses-react": "off", // https://ru.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
136
- "react/react-in-jsx-scope": "off", // https://ru.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
137
- }
138
- }
139
- ]
140
- };
1
+ /**
2
+ * Good instruction:
3
+ * https://duncanleung.com/eslint-mixed-javascript-typescript-files-codebase/
4
+ */
5
+
6
+ const jsAndTsRules = {
7
+ // Eslint rules
8
+ "sort-imports": "off", // Need found sorter
9
+ "sort-keys": "off", // More nice
10
+ "one-var": ["error", "never"], // More nice
11
+ "no-ternary": "off", // More nice
12
+ "no-void": "off", // Strange rule
13
+ "no-bitwise": "off", // Used in many projects
14
+ "no-inline-comments": "off", // Maybe later?
15
+ "line-comment-position": "off", // Maybe later?
16
+
17
+
18
+ // Eslint moved to Stylistic, but now to buggy for js. Remove after fix bugs in new versions Stylistic
19
+ "max-len": [
20
+ "error", {
21
+ code: 140,
22
+ comments: 140
23
+ }
24
+ ], // More nice, for modern screens
25
+ "padded-blocks": [
26
+ "error", {
27
+ classes: "always",
28
+ blocks: "never",
29
+ switches: "never"
30
+ }
31
+ ], // More nice
32
+ "function-call-argument-newline": ["error", "consistent"], // More nice
33
+ "quote-props": ["error", "as-needed"], // More nice
34
+ "multiline-ternary": ["error", "always-multiline"], // More nice
35
+ "array-element-newline": ["error", "consistent"], // More nice
36
+ "operator-linebreak": ["error", "after"], // More nice
37
+
38
+
39
+ // Stylistic rules
40
+ "@stylistic/max-len": [
41
+ "error", {
42
+ code: 140,
43
+ comments: 140
44
+ }
45
+ ], // More nice, for modern screens
46
+ "@stylistic/padded-blocks": [
47
+ "error", {
48
+ classes: "always",
49
+ blocks: "never",
50
+ switches: "never"
51
+ }
52
+ ], // More nice
53
+ "@stylistic/function-call-argument-newline": ["error", "consistent"], // More nice
54
+ "@stylistic/quote-props": ["error", "as-needed"], // More nice
55
+ "@stylistic/multiline-ternary": ["error", "always-multiline"], // More nice
56
+ "@stylistic/array-element-newline": ["error", "consistent"], // More nice
57
+ "@stylistic/operator-linebreak": ["error", "after"], // More nice
58
+ "@stylistic/no-extra-parens": "off",
59
+ "@stylistic/dot-location": ["error", "property"] // Maybe later?
60
+ };
61
+
62
+ module.exports = {
63
+ extends: [
64
+ "eslint:all" // There is no React because they are used strictly with Typescript.
65
+ // "plugin:@stylistic/all-extends" // Bug, begin incorrect formatting, check in new versions
66
+ ],
67
+ plugins: ["@stylistic/migrate"],
68
+ root: true,
69
+ env: {
70
+ browser: true,
71
+ es2022: true,
72
+ node: true
73
+ },
74
+ ignorePatterns: ["node_modules/*"],
75
+ rules: {
76
+ ...jsAndTsRules
77
+ },
78
+ overrides: [
79
+ {
80
+ files: ["**/*.{ts,tsx}"],
81
+ settings: {
82
+ react: {
83
+ version: "detect"
84
+ },
85
+ "import/parsers": {
86
+ "@typescript-eslint/parser": [".ts", ".tsx"]
87
+ },
88
+ "import/resolver": {
89
+ typescript: {
90
+ project: "tsconfig.json"
91
+ }
92
+ }
93
+ },
94
+ parser: "@typescript-eslint/parser",
95
+ parserOptions: {
96
+ project: "tsconfig.json",
97
+ sourceType: "module",
98
+ ecmaVersion: "latest",
99
+ ecmaFeatures: {
100
+ jsx: true
101
+ }
102
+ },
103
+ extends: [
104
+ "eslint:all",
105
+ "plugin:@stylistic/all-extends",
106
+ "plugin:@typescript-eslint/all",
107
+ "plugin:react/all",
108
+ "plugin:jsx-a11y/strict"
109
+ ],
110
+ rules: {
111
+ ...jsAndTsRules,
112
+ "no-duplicate-imports": "off", // Bug, conflict between TS import and import type
113
+
114
+ "@typescript-eslint/no-inferrable-types": "off", // Need for reflection
115
+ "@typescript-eslint/no-magic-numbers": "off",
116
+ "@typescript-eslint/prefer-readonly-parameter-types": "off", // Wrong immutable undestand
117
+ "@typescript-eslint/no-floating-promises": "off", // Block async promises
118
+ "@typescript-eslint/no-extra-parens": "off", // Conflict with react best practise in jsx
119
+ "@typescript-eslint/promise-function-async": "off", // More nice
120
+ "@typescript-eslint/no-misused-promises": ["error", {checksVoidReturn: false}], // More nice
121
+ "@typescript-eslint/naming-convention": "off", // Bad with react func components
122
+ "@typescript-eslint/no-confusing-void-expression": "off", // More nice
123
+ "@typescript-eslint/member-ordering": "off", // Need correct priority
124
+
125
+ "react/jsx-filename-extension": ["error", {extensions: [".tsx"]}], // Added typescript file extension
126
+ "react/jsx-no-literals": "off", // Broken rule, not work with ??
127
+ "react/jsx-max-depth": ["error", {max: 10}], // To small by default
128
+ "react/function-component-definition": ["error", {namedComponents: "arrow-function"}], // Same as eslint func-styles
129
+ "react/forbid-component-props": "off", // Conflict with styled-components
130
+ "react/require-default-props": "off", // Don't used in modern react
131
+ "react/jsx-uses-react": "off", // https://ru.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
132
+ "react/react-in-jsx-scope": "off" // https://ru.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
133
+ }
134
+ }
135
+ ]
136
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labeg/code-style",
3
- "version": "5.1.0",
3
+ "version": "5.3.0",
4
4
  "author": "Eugene Labutin",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/LabEG/code-style#readme",
@@ -14,8 +14,8 @@
14
14
  "url": "https://github.com/LabEG/code-style/issues"
15
15
  },
16
16
  "lint-staged": {
17
- "./testss/**/*.(ts|tsx|js|jsx)": [
18
- "eslint --fix -c .eslintrc.js --ext .tsx,.ts,.jsx,.js"
17
+ "./tests/**/*.(ts|tsx|js|jsx)": [
18
+ "eslint tests/**"
19
19
  ]
20
20
  },
21
21
  "scripts": {
@@ -24,26 +24,29 @@
24
24
  "prepare": "husky install"
25
25
  },
26
26
  "peerDependencies": {
27
+ "react": ">=15.0.0",
27
28
  "typescript": ">=5.0.0"
28
29
  },
29
30
  "dependencies": {
30
31
  "@eslint/js": "^9.17.0",
31
- "@stylistic/eslint-plugin": "^2.11.0",
32
- "@stylistic/eslint-plugin-migrate": "^2.11.0",
33
- "@typescript-eslint/eslint-plugin": "^8.16.0",
34
- "@typescript-eslint/parser": "^8.16.0",
35
- "eslint": "^9.15.0",
32
+ "@stylistic/eslint-plugin": "^2.12.1",
33
+ "@stylistic/eslint-plugin-migrate": "^2.12.1",
34
+ "@typescript-eslint/eslint-plugin": "^8.18.2",
35
+ "@typescript-eslint/parser": "^8.18.2",
36
+ "eslint": "^9.17.0",
36
37
  "eslint-plugin-jsx-a11y": "^6.10.2",
37
- "eslint-plugin-react": "^7.37.2",
38
+ "eslint-plugin-react": "^7.37.3",
38
39
  "typescript-eslint": "^8.18.2"
39
40
  },
40
41
  "devDependencies": {
41
- "@commitlint/cli": "^19.6.0",
42
+ "@commitlint/cli": "^19.6.1",
42
43
  "@commitlint/config-conventional": "^19.6.0",
43
44
  "@favware/cliff-jumper": "^5.0.0",
45
+ "@types/react": "^19.0.2",
44
46
  "husky": "^9.1.7",
45
- "typescript": "^5.7.2",
46
- "lint-staged": "^15.2.10"
47
+ "lint-staged": "^15.2.11",
48
+ "react": "^19.0.0",
49
+ "typescript": "^5.7.2"
47
50
  },
48
51
  "keywords": [
49
52
  "code style",