@labeg/code-style 5.4.0 → 6.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/eslint.config.js CHANGED
@@ -3,8 +3,8 @@ import js from "@eslint/js";
3
3
  import tseslint from "typescript-eslint";
4
4
  import stylistic from "@stylistic/eslint-plugin";
5
5
  import reactPlugin from "eslint-plugin-react";
6
- import reactHooks from 'eslint-plugin-react-hooks';
7
- import jsxA11y from "eslint-plugin-jsx-a11y";
6
+ import reactHooks from "eslint-plugin-react-hooks";
7
+ // Import jsxA11y from "eslint-plugin-jsx-a11y";
8
8
  import globals from "globals";
9
9
 
10
10
  /**
@@ -15,7 +15,7 @@ import globals from "globals";
15
15
  /** @type {import("eslint").Linter.Config} */
16
16
  export default [
17
17
  // DO NOT PUT OTHER PROPS IN THIS OBJECT
18
- {ignores: ["**/node_modules/**", "dist/"]},
18
+ {ignores: ["**/node_modules/**", "**/dist/**"]},
19
19
 
20
20
  // THE IGNORES IS APPLIED ALSO TO THESE FOLLOWING CONFIGS
21
21
  {files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"]},
@@ -25,13 +25,19 @@ export default [
25
25
  ...tseslint.configs.stylistic,
26
26
  stylistic.configs["all-flat"],
27
27
  reactPlugin.configs.flat.all,
28
- jsxA11y.flatConfigs.strict,
29
28
 
30
- { // don't support flat config yet
29
+ /*
30
+ * Have conflict with next.js:
31
+ * Config "jsx-a11y/strict": Key "plugins": Cannot redefine plugin "jsx-a11y".
32
+ * Try uncomment in next version
33
+ */
34
+ // JsxA11y.flatConfigs.strict,
35
+
36
+ { // Don't support flat config yet
31
37
  plugins: {
32
- "react-hooks": reactHooks,
38
+ "react-hooks": reactHooks
33
39
  },
34
- rules: reactHooks.configs.recommended.rules,
40
+ rules: reactHooks.configs.recommended.rules
35
41
  },
36
42
 
37
43
  ...tseslint.config({
@@ -80,6 +86,7 @@ export default [
80
86
  /**
81
87
  * Eslint rules
82
88
  */
89
+ "no-magic-numbers": "off", // Conflict with void 0
83
90
  "sort-imports": "off", // Need found sorter
84
91
  "sort-keys": "off", // More nice
85
92
  "one-var": ["error", "never"], // More nice
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labeg/code-style",
3
- "version": "5.4.0",
3
+ "version": "6.0.0",
4
4
  "author": "Eugene Labutin",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/LabEG/code-style#readme",
package/.eslintrc.js DELETED
@@ -1,136 +0,0 @@
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
- };