@lzear/eslint-config 3.0.0 → 4.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.
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
- mod
19
- ));
20
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
21
- const utils = require("../../utils.cjs");
22
- const react = async (config) => {
23
- if (!config.react) {
24
- return {};
25
- }
26
- const [
27
- reactCompilerPlugin,
28
- reactHooksPlugin,
29
- reactPerfPlugin,
30
- reactPlugin,
31
- nextPlugin
32
- ] = await Promise.all([
33
- utils.interopDefault(import("eslint-plugin-react-compiler")),
34
- utils.interopDefault(import("eslint-plugin-react-hooks")),
35
- utils.interopDefault(import("eslint-plugin-react-perf")),
36
- utils.interopDefault(import("eslint-plugin-react")),
37
- utils.interopDefault(import("@next/eslint-plugin-next"))
38
- ]);
39
- const files = ["**/*.jsx"];
40
- if (config.typescript) {
41
- files.push("**/*.tsx");
42
- }
43
- return {
44
- name: "lzear/react",
45
- files,
46
- plugins: {
47
- "@next/next": nextPlugin,
48
- react: reactPlugin,
49
- "react-compiler": reactCompilerPlugin,
50
- "react-hooks": reactHooksPlugin,
51
- "react-perf": reactPerfPlugin
52
- },
53
- rules: {
54
- "react-compiler/react-compiler": 2,
55
- ...reactHooksPlugin.configs.recommended.rules,
56
- ...reactPerfPlugin.configs.recommended.rules,
57
- "react-perf/jsx-no-new-function-as-prop": 0,
58
- "react-perf/jsx-no-new-object-as-prop": 0,
59
- ...reactPlugin.configs.recommended.rules,
60
- ...nextPlugin.configs.recommended.rules,
61
- ...nextPlugin.configs["core-web-vitals"].rules,
62
- "react/react-in-jsx-scope": 0
63
- },
64
- settings: {
65
- react: {
66
- fragment: "Fragment",
67
- pragma: "React",
68
- version: "detect"
69
- }
70
- }
71
- };
72
- };
73
- exports.react = react;
@@ -1,55 +0,0 @@
1
- import { interopDefault } from "../../utils.mjs";
2
- const react = async (config) => {
3
- if (!config.react) {
4
- return {};
5
- }
6
- const [
7
- reactCompilerPlugin,
8
- reactHooksPlugin,
9
- reactPerfPlugin,
10
- reactPlugin,
11
- nextPlugin
12
- ] = await Promise.all([
13
- interopDefault(import("eslint-plugin-react-compiler")),
14
- interopDefault(import("eslint-plugin-react-hooks")),
15
- interopDefault(import("eslint-plugin-react-perf")),
16
- interopDefault(import("eslint-plugin-react")),
17
- interopDefault(import("@next/eslint-plugin-next"))
18
- ]);
19
- const files = ["**/*.jsx"];
20
- if (config.typescript) {
21
- files.push("**/*.tsx");
22
- }
23
- return {
24
- name: "lzear/react",
25
- files,
26
- plugins: {
27
- "@next/next": nextPlugin,
28
- react: reactPlugin,
29
- "react-compiler": reactCompilerPlugin,
30
- "react-hooks": reactHooksPlugin,
31
- "react-perf": reactPerfPlugin
32
- },
33
- rules: {
34
- "react-compiler/react-compiler": 2,
35
- ...reactHooksPlugin.configs.recommended.rules,
36
- ...reactPerfPlugin.configs.recommended.rules,
37
- "react-perf/jsx-no-new-function-as-prop": 0,
38
- "react-perf/jsx-no-new-object-as-prop": 0,
39
- ...reactPlugin.configs.recommended.rules,
40
- ...nextPlugin.configs.recommended.rules,
41
- ...nextPlugin.configs["core-web-vitals"].rules,
42
- "react/react-in-jsx-scope": 0
43
- },
44
- settings: {
45
- react: {
46
- fragment: "Fragment",
47
- pragma: "React",
48
- version: "detect"
49
- }
50
- }
51
- };
52
- };
53
- export {
54
- react
55
- };
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const ignores = [
4
- "**/.eslint-config-inspector/**",
5
- "**/vite.config.*.timestamp-*",
6
- "**/.vitepress/cache/**",
7
- "**/node_modules/**",
8
- "**/coverage/**",
9
- "**/.history/**",
10
- "**/.netlify/**",
11
- "**/.vercel/**",
12
- "**/.output/**",
13
- "**/output/**",
14
- "**/.cache/**",
15
- "**/.temp/**",
16
- "**/build/**",
17
- "**/.nuxt/**",
18
- "**/.next/**",
19
- "**/dist/**",
20
- "**/temp/**",
21
- "**/.tmp/**",
22
- "**/tmp/**"
23
- ];
24
- exports.ignores = ignores;
@@ -1,24 +0,0 @@
1
- const ignores = [
2
- "**/.eslint-config-inspector/**",
3
- "**/vite.config.*.timestamp-*",
4
- "**/.vitepress/cache/**",
5
- "**/node_modules/**",
6
- "**/coverage/**",
7
- "**/.history/**",
8
- "**/.netlify/**",
9
- "**/.vercel/**",
10
- "**/.output/**",
11
- "**/output/**",
12
- "**/.cache/**",
13
- "**/.temp/**",
14
- "**/build/**",
15
- "**/.nuxt/**",
16
- "**/.next/**",
17
- "**/dist/**",
18
- "**/temp/**",
19
- "**/.tmp/**",
20
- "**/tmp/**"
21
- ];
22
- export {
23
- ignores
24
- };
@@ -1,53 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
- mod
19
- ));
20
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
21
- const js = require("@eslint/js");
22
- const tseslint = require("typescript-eslint");
23
- const utils = require("../../utils.cjs");
24
- const typescript = async (config) => {
25
- if (!config.typescript) {
26
- return [];
27
- }
28
- const { parser: typescriptParser } = await utils.interopDefault(
29
- import("typescript-eslint")
30
- );
31
- const files = ["**/*.ts", "**/*.tsx", "**/*.cts", "**/*.mts"];
32
- return tseslint.config({
33
- name: "lzear/typescript",
34
- extends: [
35
- js.configs.recommended,
36
- tseslint.configs.recommendedTypeChecked,
37
- tseslint.configs.stylisticTypeChecked
38
- ],
39
- files,
40
- languageOptions: {
41
- parser: typescriptParser,
42
- parserOptions: {
43
- ecmaFeatures: { jsx: config.react },
44
- ecmaVersion: "latest",
45
- project: true,
46
- projectService: true,
47
- sourceType: "module",
48
- tsconfigRootDir: process.cwd()
49
- }
50
- }
51
- });
52
- };
53
- exports.typescript = typescript;
@@ -1,35 +0,0 @@
1
- import js from "@eslint/js";
2
- import tseslint from "typescript-eslint";
3
- import { interopDefault } from "../../utils.mjs";
4
- const typescript = async (config) => {
5
- if (!config.typescript) {
6
- return [];
7
- }
8
- const { parser: typescriptParser } = await interopDefault(
9
- import("typescript-eslint")
10
- );
11
- const files = ["**/*.ts", "**/*.tsx", "**/*.cts", "**/*.mts"];
12
- return tseslint.config({
13
- name: "lzear/typescript",
14
- extends: [
15
- js.configs.recommended,
16
- tseslint.configs.recommendedTypeChecked,
17
- tseslint.configs.stylisticTypeChecked
18
- ],
19
- files,
20
- languageOptions: {
21
- parser: typescriptParser,
22
- parserOptions: {
23
- ecmaFeatures: { jsx: config.react },
24
- ecmaVersion: "latest",
25
- project: true,
26
- projectService: true,
27
- sourceType: "module",
28
- tsconfigRootDir: process.cwd()
29
- }
30
- }
31
- });
32
- };
33
- export {
34
- typescript
35
- };
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
- mod
19
- ));
20
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
21
- const utils = require("../../utils.cjs");
22
- const vitest = async (config) => {
23
- if (!config.vitest) {
24
- return {};
25
- }
26
- const vitestPlugin = await utils.interopDefault(import("@vitest/eslint-plugin"));
27
- const files = [
28
- "**/test/*.js",
29
- "**/test/*.cjs",
30
- "**/test/*.mjs",
31
- "**/*.test.js",
32
- "**/*.test.cjs",
33
- "**/*.test.mjs"
34
- ];
35
- if (config.typescript) {
36
- files.push(
37
- "**/test/*.ts",
38
- "**/test/*.cts",
39
- "**/test/*.mts",
40
- "**/*.test.ts",
41
- "**/*.test.cts",
42
- "**/*.test.mts"
43
- );
44
- }
45
- if (config.react) {
46
- files.push("**/test/*.jsx", "**/*.test.jsx");
47
- if (config.typescript) {
48
- files.push("**/test/*.tsx", "**/*.test.tsx");
49
- }
50
- }
51
- return {
52
- name: "lzear/vitest",
53
- files,
54
- plugins: {
55
- vitest: vitestPlugin
56
- },
57
- rules: { ...vitestPlugin.configs.recommended.rules },
58
- settings: {
59
- vitest: {
60
- typecheck: true
61
- }
62
- }
63
- };
64
- };
65
- exports.vitest = vitest;
@@ -1,47 +0,0 @@
1
- import { interopDefault } from "../../utils.mjs";
2
- const vitest = async (config) => {
3
- if (!config.vitest) {
4
- return {};
5
- }
6
- const vitestPlugin = await interopDefault(import("@vitest/eslint-plugin"));
7
- const files = [
8
- "**/test/*.js",
9
- "**/test/*.cjs",
10
- "**/test/*.mjs",
11
- "**/*.test.js",
12
- "**/*.test.cjs",
13
- "**/*.test.mjs"
14
- ];
15
- if (config.typescript) {
16
- files.push(
17
- "**/test/*.ts",
18
- "**/test/*.cts",
19
- "**/test/*.mts",
20
- "**/*.test.ts",
21
- "**/*.test.cts",
22
- "**/*.test.mts"
23
- );
24
- }
25
- if (config.react) {
26
- files.push("**/test/*.jsx", "**/*.test.jsx");
27
- if (config.typescript) {
28
- files.push("**/test/*.tsx", "**/*.test.tsx");
29
- }
30
- }
31
- return {
32
- name: "lzear/vitest",
33
- files,
34
- plugins: {
35
- vitest: vitestPlugin
36
- },
37
- rules: { ...vitestPlugin.configs.recommended.rules },
38
- settings: {
39
- vitest: {
40
- typecheck: true
41
- }
42
- }
43
- };
44
- };
45
- export {
46
- vitest
47
- };
package/dist/index.cjs DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const index$1 = require("./configs/a11y/index.cjs");
4
- const index = require("./configs/core/index.cjs");
5
- const index$3 = require("./configs/node/index.cjs");
6
- const index$6 = require("./configs/package-json/index.cjs");
7
- const index$7 = require("./configs/perfectionist/index.cjs");
8
- const index$2 = require("./configs/react/index.cjs");
9
- const files = require("./configs/src/files.cjs");
10
- const index$4 = require("./configs/typescript/index.cjs");
11
- const index$5 = require("./configs/vitest/index.cjs");
12
- const CONFIG_OPTIONS = [
13
- "perfectionist",
14
- "typescript",
15
- "vitest",
16
- "react",
17
- "node"
18
- ];
19
- const configGenerator = async ({
20
- extends: customExtends = {},
21
- ...rawConfig
22
- } = {}) => {
23
- const config = {};
24
- for (const configName of CONFIG_OPTIONS) {
25
- config[configName] = rawConfig[configName] ?? false;
26
- }
27
- const configFunctions = [
28
- index.core,
29
- index$1.a11y,
30
- index$2.react,
31
- index$3.node,
32
- index$4.typescript,
33
- index$5.vitest,
34
- index$6.packageJson,
35
- index$7.perfectionist
36
- ];
37
- const configs = await Promise.all(
38
- configFunctions.map((createConfigFunction) => createConfigFunction(config))
39
- );
40
- return [
41
- { name: "lzear/core/ignores", ignores: files.ignores },
42
- ...configs.flat(),
43
- ...Array.isArray(customExtends) ? customExtends : [
44
- {
45
- name: "lzear/custom-extends",
46
- ...customExtends
47
- }
48
- ]
49
- ];
50
- };
51
- const defaultOptions = {
52
- perfectionist: true,
53
- typescript: true,
54
- vitest: true,
55
- react: true,
56
- node: true
57
- };
58
- exports.default = configGenerator;
59
- exports.defaultOptions = defaultOptions;
package/dist/index.mjs DELETED
@@ -1,59 +0,0 @@
1
- import { a11y } from "./configs/a11y/index.mjs";
2
- import { core } from "./configs/core/index.mjs";
3
- import { node } from "./configs/node/index.mjs";
4
- import { packageJson } from "./configs/package-json/index.mjs";
5
- import { perfectionist } from "./configs/perfectionist/index.mjs";
6
- import { react } from "./configs/react/index.mjs";
7
- import { ignores } from "./configs/src/files.mjs";
8
- import { typescript } from "./configs/typescript/index.mjs";
9
- import { vitest } from "./configs/vitest/index.mjs";
10
- const CONFIG_OPTIONS = [
11
- "perfectionist",
12
- "typescript",
13
- "vitest",
14
- "react",
15
- "node"
16
- ];
17
- const configGenerator = async ({
18
- extends: customExtends = {},
19
- ...rawConfig
20
- } = {}) => {
21
- const config = {};
22
- for (const configName of CONFIG_OPTIONS) {
23
- config[configName] = rawConfig[configName] ?? false;
24
- }
25
- const configFunctions = [
26
- core,
27
- a11y,
28
- react,
29
- node,
30
- typescript,
31
- vitest,
32
- packageJson,
33
- perfectionist
34
- ];
35
- const configs = await Promise.all(
36
- configFunctions.map((createConfigFunction) => createConfigFunction(config))
37
- );
38
- return [
39
- { name: "lzear/core/ignores", ignores },
40
- ...configs.flat(),
41
- ...Array.isArray(customExtends) ? customExtends : [
42
- {
43
- name: "lzear/custom-extends",
44
- ...customExtends
45
- }
46
- ]
47
- ];
48
- };
49
- const defaultOptions = {
50
- perfectionist: true,
51
- typescript: true,
52
- vitest: true,
53
- react: true,
54
- node: true
55
- };
56
- export {
57
- configGenerator as default,
58
- defaultOptions
59
- };
package/dist/utils.cjs DELETED
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const interopDefault = async (module2) => {
4
- try {
5
- const resolved = await module2;
6
- if (typeof resolved === "object" && resolved) {
7
- if ("default" in resolved && Object.keys(resolved).length === 1) {
8
- const defaultExport = resolved.default;
9
- if (!defaultExport) {
10
- return defaultExport;
11
- }
12
- return defaultExport;
13
- }
14
- return resolved;
15
- }
16
- return resolved;
17
- } catch (error) {
18
- throw new Error(`Cannot import module: ${String(error)}`);
19
- }
20
- };
21
- exports.interopDefault = interopDefault;
package/dist/utils.mjs DELETED
@@ -1,21 +0,0 @@
1
- const interopDefault = async (module) => {
2
- try {
3
- const resolved = await module;
4
- if (typeof resolved === "object" && resolved) {
5
- if ("default" in resolved && Object.keys(resolved).length === 1) {
6
- const defaultExport = resolved.default;
7
- if (!defaultExport) {
8
- return defaultExport;
9
- }
10
- return defaultExport;
11
- }
12
- return resolved;
13
- }
14
- return resolved;
15
- } catch (error) {
16
- throw new Error(`Cannot import module: ${String(error)}`);
17
- }
18
- };
19
- export {
20
- interopDefault
21
- };
package/license.md DELETED
@@ -1,20 +0,0 @@
1
- # The MIT License (MIT)
2
-
3
- Copyright 2023 Azat S. <to@azat.io>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/readme.md DELETED
@@ -1,44 +0,0 @@
1
- # ESLint Config
2
-
3
- [![Version](https://img.shields.io/npm/v/@lzear/eslint-config.svg?color=4a32c3&labelColor=26272b)](https://npmjs.com/package/@lzear/eslint-configt)
4
- [![GitHub License](https://img.shields.io/badge/license-MIT-232428.svg?color=4a32c3&labelColor=26272b)](https://github.com/azat-io/eslint-config/blob/main/license.md)
5
-
6
- My preferred ESLint configuration. Forked from [azat-io/eslint-config](https://github.com/azat-io/eslint-config), with some modifications including:
7
-
8
- - Use recommended presets from the plugins instead of managing the rules manually.
9
- - Changing rules to my personal preferences.
10
-
11
- ## Usage
12
-
13
- 1. Install package:
14
-
15
- ```sh
16
- yarn add --D eslint @lzear/eslint-config
17
- ```
18
-
19
- 2. Create ESLint configuration file `eslint.config.js`:
20
-
21
- ```js
22
- import eslintConfig from '@lzear/eslint-config'
23
-
24
- export default eslintConfig({
25
- perfectionist: true,
26
- typescript: true,
27
- react: true,
28
- node: true,
29
- })
30
- ```
31
-
32
- 3. Add script for `package.json`:
33
-
34
- ```json
35
- {
36
- "scripts": {
37
- "test:js": "eslint \"**/*.{js,ts,jsx,tsx,json}\""
38
- }
39
- }
40
- ```
41
-
42
- ## License
43
-
44
- MIT &copy; [Azat S.](https://azat.io)