@labeg/code-style 5.3.1 → 5.3.2

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