eslint-config-mgz 1.0.5 → 1.0.8

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/README.md CHANGED
@@ -33,15 +33,27 @@ Shared ESLint configuration for React + TypeScript projects
33
33
  ### 🚀 Установка
34
34
 
35
35
  ```bash
36
+ # ESLint v7-8 (обязательные)
36
37
  npm install -D eslint-config-mgz eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-jsx-a11y eslint-config-prettier
38
+
39
+ # ESLint v9+ (обязательные + опциональные)
40
+ npm install -D eslint-config-mgz eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-jsx-a11y eslint-config-prettier @eslint/js typescript-eslint
37
41
  ```
38
42
 
39
43
  ```bash
44
+ # ESLint v7-8 (обязательные)
40
45
  pnpm add -D eslint-config-mgz eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-jsx-a11y eslint-config-prettier
46
+
47
+ # ESLint v9+ (обязательные + опциональные)
48
+ pnpm add -D eslint-config-mgz eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-jsx-a11y eslint-config-prettier @eslint/js typescript-eslint
41
49
  ```
42
50
 
43
51
  ```bash
52
+ # ESLint v7-8 (обязательные)
44
53
  yarn add -D eslint-config-mgz eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-jsx-a11y eslint-config-prettier
54
+
55
+ # ESLint v9+ (обязательные + опциональные)
56
+ yarn add -D eslint-config-mgz eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-jsx-a11y eslint-config-prettier @eslint/js typescript-eslint
45
57
  ```
46
58
 
47
59
  ---
package/flat-config.js CHANGED
@@ -1,12 +1,80 @@
1
- // Flat config for ESLint v9+
2
- // Usage: import config from 'eslint-config-mgz/flat-config';
1
+ // eslint-config-mgz/flat-config.js
2
+ import { configs as jsConfigs } from "@eslint/js";
3
+ import tsPlugin from "@typescript-eslint/eslint-plugin";
4
+ import tsParser from "@typescript-eslint/parser";
5
+ import reactPlugin from "eslint-plugin-react";
6
+ import reactHooksPlugin from "eslint-plugin-react-hooks";
7
+ import importPlugin from "eslint-plugin-import";
8
+ import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
3
9
 
4
- const { FlatCompat } = require("@eslint/eslintrc");
5
- const baseConfig = require("./base");
10
+ export default [
11
+ // Игнорируем лишние файлы
12
+ {
13
+ ignores: [
14
+ "dist/**",
15
+ "build/**",
16
+ "node_modules/**",
17
+ ".eslintrc.*",
18
+ ".prettierrc.*",
19
+ "eslint.config.*",
20
+ ],
21
+ },
6
22
 
7
- const compat = new FlatCompat({
8
- baseDirectory: __dirname,
9
- resolvePluginsRelativeTo: __dirname,
10
- });
23
+ // Базовые правила ESLint
24
+ jsConfigs.recommended,
11
25
 
12
- module.exports = compat.config(baseConfig);
26
+ // TypeScript rules
27
+ {
28
+ files: ["**/*.{ts,tsx}"],
29
+ languageOptions: {
30
+ parser: tsParser,
31
+ parserOptions: {
32
+ project: "./tsconfig.json",
33
+ ecmaVersion: "latest",
34
+ sourceType: "module",
35
+ },
36
+ },
37
+ rules: {
38
+ ...tsPlugin.configs.recommended.rules,
39
+ "@typescript-eslint/no-unused-vars": "warn",
40
+ "@typescript-eslint/no-explicit-any": "warn",
41
+ "@typescript-eslint/prefer-const": "error",
42
+ },
43
+ },
44
+
45
+ // React rules
46
+ {
47
+ files: ["**/*.{jsx,tsx}"],
48
+ plugins: {
49
+ react: reactPlugin,
50
+ "react-hooks": reactHooksPlugin,
51
+ import: importPlugin,
52
+ "jsx-a11y": jsxA11yPlugin,
53
+ },
54
+ rules: {
55
+ "react/react-in-jsx-scope": "off",
56
+ "react/prop-types": "off",
57
+ "react/display-name": "off",
58
+ "react/no-array-index-key": "warn",
59
+ "react-hooks/rules-of-hooks": "error",
60
+ "react-hooks/exhaustive-deps": "warn",
61
+ "import/no-unresolved": "off",
62
+ "import/named": "off",
63
+ "jsx-a11y/no-autofocus": "off",
64
+ "jsx-a11y/anchor-has-content": "off",
65
+ "jsx-a11y/heading-has-content": "off",
66
+ "no-alert": "error",
67
+ "no-console": "error",
68
+ "no-undef-init": "error",
69
+ "no-undefined": "error",
70
+ "no-var": "error",
71
+ "no-inline-comments": "off",
72
+ "no-use-before-define": "off",
73
+ "no-duplicate-imports": "warn",
74
+ "react/no-unknown-property": [
75
+ "error",
76
+ { ignore: ["cmdk-input-wrapper", "cmdk-empty"] },
77
+ ],
78
+ },
79
+ },
80
+ ];
package/index.js ADDED
@@ -0,0 +1,27 @@
1
+ // eslint-config-mgz/index.js
2
+ function isEslintV9Plus() {
3
+ try {
4
+ require.resolve("@eslint/js");
5
+ return true;
6
+ } catch {
7
+ return false;
8
+ }
9
+ }
10
+
11
+ let config;
12
+
13
+ if (isEslintV9Plus()) {
14
+ config = require("./flat-config").default;
15
+ } else {
16
+ const { FlatCompat } = require("@eslint/eslintrc");
17
+ const baseConfig = require("./base");
18
+
19
+ const compat = new FlatCompat({
20
+ baseDirectory: __dirname,
21
+ resolvePluginsRelativeTo: __dirname,
22
+ });
23
+
24
+ config = compat.config(baseConfig);
25
+ }
26
+
27
+ module.exports = config;
package/package.json CHANGED
@@ -1,26 +1,8 @@
1
1
  {
2
2
  "name": "eslint-config-mgz",
3
- "version": "1.0.5",
4
- "description": "Shared ESLint config for React + TypeScript projects",
5
- "main": "base.js",
6
- "files": [
7
- "README.md",
8
- "base.js",
9
- "flat-config.js"
10
- ],
11
- "readme": "README.md",
12
- "exports": {
13
- ".": "./base.js",
14
- "./flat-config": "./flat-config.js"
15
- },
16
- "keywords": [
17
- "eslint",
18
- "typescript",
19
- "react",
20
- "shared-config"
21
- ],
22
- "author": "DSRC TEAM",
23
- "license": "MIT",
3
+ "version": "1.0.8",
4
+ "main": "index.js",
5
+ "type": "commonjs",
24
6
  "peerDependencies": {
25
7
  "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0",
26
8
  "@typescript-eslint/parser": "^6.0.0 || ^7.0.0 || ^8.0.0",
@@ -30,8 +12,5 @@
30
12
  "eslint-plugin-import": "^2.0.0",
31
13
  "eslint-plugin-jsx-a11y": "^6.0.0",
32
14
  "eslint-config-prettier": "^9.0.0"
33
- },
34
- "engines": {
35
- "node": ">=18"
36
15
  }
37
16
  }