neatlint 1.1.7 → 1.1.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/dist/main.d.mts CHANGED
@@ -1,4 +1,25 @@
1
- export { Neatlint } from './utils/Neatlint.util.mjs';
2
- export { ESLintConfig } from './types/ESLintConfig.type.mjs';
3
- export { NeatlintOptions } from './types/NeatlintOptions.type.mjs';
4
- import 'eslint';
1
+ import { Linter } from 'eslint';
2
+
3
+ type ESLintConfig = Linter.Config;
4
+
5
+ type NeatlintOptions = {
6
+ disabled?: boolean;
7
+ ignores?: ESLintConfig['ignores'];
8
+ javascript?: {
9
+ files?: ESLintConfig['files'];
10
+ languageOptions?: ESLintConfig['languageOptions'];
11
+ plugins?: ESLintConfig['plugins'];
12
+ rules?: ESLintConfig['rules'];
13
+ };
14
+ typescript?: {
15
+ files?: ESLintConfig['files'];
16
+ languageOptions?: ESLintConfig['languageOptions'];
17
+ plugins?: ESLintConfig['plugins'];
18
+ rules?: ESLintConfig['rules'];
19
+ };
20
+ config?: ESLintConfig[];
21
+ };
22
+
23
+ declare const Neatlint: (options?: NeatlintOptions) => ESLintConfig[];
24
+
25
+ export { type ESLintConfig, Neatlint, type NeatlintOptions };
package/dist/main.d.ts CHANGED
@@ -1,4 +1,25 @@
1
- export { Neatlint } from './utils/Neatlint.util.js';
2
- export { ESLintConfig } from './types/ESLintConfig.type.js';
3
- export { NeatlintOptions } from './types/NeatlintOptions.type.js';
4
- import 'eslint';
1
+ import { Linter } from 'eslint';
2
+
3
+ type ESLintConfig = Linter.Config;
4
+
5
+ type NeatlintOptions = {
6
+ disabled?: boolean;
7
+ ignores?: ESLintConfig['ignores'];
8
+ javascript?: {
9
+ files?: ESLintConfig['files'];
10
+ languageOptions?: ESLintConfig['languageOptions'];
11
+ plugins?: ESLintConfig['plugins'];
12
+ rules?: ESLintConfig['rules'];
13
+ };
14
+ typescript?: {
15
+ files?: ESLintConfig['files'];
16
+ languageOptions?: ESLintConfig['languageOptions'];
17
+ plugins?: ESLintConfig['plugins'];
18
+ rules?: ESLintConfig['rules'];
19
+ };
20
+ config?: ESLintConfig[];
21
+ };
22
+
23
+ declare const Neatlint: (options?: NeatlintOptions) => ESLintConfig[];
24
+
25
+ export { type ESLintConfig, Neatlint, type NeatlintOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neatlint",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "Strict ESLint presets for modern TypeScript projects.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/keift/neatlint",
@@ -1,3 +0,0 @@
1
- export { ESLintConfig } from '../types/ESLintConfig.type.mjs';
2
- export { NeatlintOptions } from '../types/NeatlintOptions.type.mjs';
3
- import 'eslint';
@@ -1,3 +0,0 @@
1
- export { ESLintConfig } from '../types/ESLintConfig.type.js';
2
- export { NeatlintOptions } from '../types/NeatlintOptions.type.js';
3
- import 'eslint';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/barrels/Types.barrel.ts
17
- var Types_barrel_exports = {};
18
- module.exports = __toCommonJS(Types_barrel_exports);
File without changes
@@ -1,7 +0,0 @@
1
- import { NeatlintOptions } from '../types/NeatlintOptions.type.mjs';
2
- import '../types/ESLintConfig.type.mjs';
3
- import 'eslint';
4
-
5
- declare const NeatlintOptionsDefault: NeatlintOptions;
6
-
7
- export { NeatlintOptionsDefault };
@@ -1,7 +0,0 @@
1
- import { NeatlintOptions } from '../types/NeatlintOptions.type.js';
2
- import '../types/ESLintConfig.type.js';
3
- import 'eslint';
4
-
5
- declare const NeatlintOptionsDefault: NeatlintOptions;
6
-
7
- export { NeatlintOptionsDefault };
@@ -1,108 +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 __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/defaults/NeatlintOptions.default.ts
31
- var NeatlintOptions_default_exports = {};
32
- __export(NeatlintOptions_default_exports, {
33
- NeatlintOptionsDefault: () => NeatlintOptionsDefault
34
- });
35
- module.exports = __toCommonJS(NeatlintOptions_default_exports);
36
- var import_typescript_eslint = __toESM(require("typescript-eslint"));
37
- var import_js = __toESM(require("@eslint/js"));
38
- var NeatlintOptionsDefault = {
39
- disabled: false,
40
- ignores: ["./dist/**"],
41
- javascript: {
42
- files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
43
- languageOptions: {},
44
- plugins: {},
45
- rules: {
46
- ...import_js.default.configs.recommended.rules,
47
- ...Object.assign(
48
- {},
49
- ...import_typescript_eslint.default.configs.strictTypeChecked.map(
50
- (item) => Object.fromEntries(
51
- Object.entries(item.rules ?? {}).filter(([key]) => !key.startsWith("@typescript-eslint")).map(([key]) => [key, "error"])
52
- )
53
- )
54
- ),
55
- ...Object.assign(
56
- {},
57
- ...import_typescript_eslint.default.configs.stylisticTypeChecked.map(
58
- (item) => Object.fromEntries(
59
- Object.entries(item.rules ?? {}).filter(([key]) => !key.startsWith("@typescript-eslint")).map(([key]) => [key, "error"])
60
- )
61
- )
62
- ),
63
- ...import_typescript_eslint.default.configs.eslintRecommended.rules,
64
- "no-undef": "off",
65
- "func-style": ["error", "expression", { allowArrowFunctions: true }],
66
- "no-duplicate-imports": "error",
67
- "no-eval": "error",
68
- "no-restricted-syntax": ["error", "DebuggerStatement", "EmptyStatement", "ForInStatement", "LabeledStatement", "SequenceExpression", "SwitchStatement", "WithStatement"],
69
- "no-useless-call": "error",
70
- "no-useless-computed-key": "error",
71
- "no-useless-concat": "error",
72
- "no-useless-rename": "error",
73
- "no-useless-return": "error",
74
- "object-shorthand": "error",
75
- "prefer-arrow-callback": "error",
76
- "prefer-template": "error",
77
- eqeqeq: "error"
78
- }
79
- },
80
- typescript: {
81
- files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
82
- languageOptions: {
83
- parser: import_typescript_eslint.default.parser,
84
- parserOptions: {
85
- project: "./tsconfig.json",
86
- sourceType: "module"
87
- }
88
- },
89
- plugins: {
90
- "@typescript-eslint": import_typescript_eslint.default.plugin
91
- },
92
- rules: {
93
- ...Object.assign({}, ...import_typescript_eslint.default.configs.strictTypeChecked.map((item) => item.rules ?? {})),
94
- ...Object.assign({}, ...import_typescript_eslint.default.configs.stylisticTypeChecked.map((item) => item.rules ?? {})),
95
- "@typescript-eslint/consistent-type-definitions": ["error", "type"],
96
- // stylisticTypeChecked but different
97
- "@typescript-eslint/consistent-type-exports": "error",
98
- "@typescript-eslint/consistent-type-imports": "error",
99
- "@typescript-eslint/explicit-member-accessibility": "error",
100
- "@typescript-eslint/prefer-readonly": "error",
101
- "@typescript-eslint/strict-boolean-expressions": "error"
102
- }
103
- }
104
- };
105
- // Annotate the CommonJS export names for ESM import in node:
106
- 0 && (module.exports = {
107
- NeatlintOptionsDefault
108
- });
@@ -1,73 +0,0 @@
1
- // src/defaults/NeatlintOptions.default.ts
2
- import TSESLint from "typescript-eslint";
3
- import ESLintJS from "@eslint/js";
4
- var NeatlintOptionsDefault = {
5
- disabled: false,
6
- ignores: ["./dist/**"],
7
- javascript: {
8
- files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
9
- languageOptions: {},
10
- plugins: {},
11
- rules: {
12
- ...ESLintJS.configs.recommended.rules,
13
- ...Object.assign(
14
- {},
15
- ...TSESLint.configs.strictTypeChecked.map(
16
- (item) => Object.fromEntries(
17
- Object.entries(item.rules ?? {}).filter(([key]) => !key.startsWith("@typescript-eslint")).map(([key]) => [key, "error"])
18
- )
19
- )
20
- ),
21
- ...Object.assign(
22
- {},
23
- ...TSESLint.configs.stylisticTypeChecked.map(
24
- (item) => Object.fromEntries(
25
- Object.entries(item.rules ?? {}).filter(([key]) => !key.startsWith("@typescript-eslint")).map(([key]) => [key, "error"])
26
- )
27
- )
28
- ),
29
- ...TSESLint.configs.eslintRecommended.rules,
30
- "no-undef": "off",
31
- "func-style": ["error", "expression", { allowArrowFunctions: true }],
32
- "no-duplicate-imports": "error",
33
- "no-eval": "error",
34
- "no-restricted-syntax": ["error", "DebuggerStatement", "EmptyStatement", "ForInStatement", "LabeledStatement", "SequenceExpression", "SwitchStatement", "WithStatement"],
35
- "no-useless-call": "error",
36
- "no-useless-computed-key": "error",
37
- "no-useless-concat": "error",
38
- "no-useless-rename": "error",
39
- "no-useless-return": "error",
40
- "object-shorthand": "error",
41
- "prefer-arrow-callback": "error",
42
- "prefer-template": "error",
43
- eqeqeq: "error"
44
- }
45
- },
46
- typescript: {
47
- files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
48
- languageOptions: {
49
- parser: TSESLint.parser,
50
- parserOptions: {
51
- project: "./tsconfig.json",
52
- sourceType: "module"
53
- }
54
- },
55
- plugins: {
56
- "@typescript-eslint": TSESLint.plugin
57
- },
58
- rules: {
59
- ...Object.assign({}, ...TSESLint.configs.strictTypeChecked.map((item) => item.rules ?? {})),
60
- ...Object.assign({}, ...TSESLint.configs.stylisticTypeChecked.map((item) => item.rules ?? {})),
61
- "@typescript-eslint/consistent-type-definitions": ["error", "type"],
62
- // stylisticTypeChecked but different
63
- "@typescript-eslint/consistent-type-exports": "error",
64
- "@typescript-eslint/consistent-type-imports": "error",
65
- "@typescript-eslint/explicit-member-accessibility": "error",
66
- "@typescript-eslint/prefer-readonly": "error",
67
- "@typescript-eslint/strict-boolean-expressions": "error"
68
- }
69
- }
70
- };
71
- export {
72
- NeatlintOptionsDefault
73
- };
@@ -1,5 +0,0 @@
1
- import { Linter } from 'eslint';
2
-
3
- type ESLintConfig = Linter.Config;
4
-
5
- export type { ESLintConfig };
@@ -1,5 +0,0 @@
1
- import { Linter } from 'eslint';
2
-
3
- type ESLintConfig = Linter.Config;
4
-
5
- export type { ESLintConfig };
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/types/ESLintConfig.type.ts
17
- var ESLintConfig_type_exports = {};
18
- module.exports = __toCommonJS(ESLintConfig_type_exports);
File without changes
@@ -1,22 +0,0 @@
1
- import { ESLintConfig } from './ESLintConfig.type.mjs';
2
- import 'eslint';
3
-
4
- type NeatlintOptions = {
5
- disabled?: boolean;
6
- ignores?: ESLintConfig['ignores'];
7
- javascript?: {
8
- files?: ESLintConfig['files'];
9
- languageOptions?: ESLintConfig['languageOptions'];
10
- plugins?: ESLintConfig['plugins'];
11
- rules?: ESLintConfig['rules'];
12
- };
13
- typescript?: {
14
- files?: ESLintConfig['files'];
15
- languageOptions?: ESLintConfig['languageOptions'];
16
- plugins?: ESLintConfig['plugins'];
17
- rules?: ESLintConfig['rules'];
18
- };
19
- config?: ESLintConfig[];
20
- };
21
-
22
- export type { NeatlintOptions };
@@ -1,22 +0,0 @@
1
- import { ESLintConfig } from './ESLintConfig.type.js';
2
- import 'eslint';
3
-
4
- type NeatlintOptions = {
5
- disabled?: boolean;
6
- ignores?: ESLintConfig['ignores'];
7
- javascript?: {
8
- files?: ESLintConfig['files'];
9
- languageOptions?: ESLintConfig['languageOptions'];
10
- plugins?: ESLintConfig['plugins'];
11
- rules?: ESLintConfig['rules'];
12
- };
13
- typescript?: {
14
- files?: ESLintConfig['files'];
15
- languageOptions?: ESLintConfig['languageOptions'];
16
- plugins?: ESLintConfig['plugins'];
17
- rules?: ESLintConfig['rules'];
18
- };
19
- config?: ESLintConfig[];
20
- };
21
-
22
- export type { NeatlintOptions };
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/types/NeatlintOptions.type.ts
17
- var NeatlintOptions_type_exports = {};
18
- module.exports = __toCommonJS(NeatlintOptions_type_exports);
File without changes
@@ -1,7 +0,0 @@
1
- import { ESLintConfig } from '../types/ESLintConfig.type.mjs';
2
- import { NeatlintOptions } from '../types/NeatlintOptions.type.mjs';
3
- import 'eslint';
4
-
5
- declare const Neatlint: (options?: NeatlintOptions) => ESLintConfig[];
6
-
7
- export { Neatlint };
@@ -1,7 +0,0 @@
1
- import { ESLintConfig } from '../types/ESLintConfig.type.js';
2
- import { NeatlintOptions } from '../types/NeatlintOptions.type.js';
3
- import 'eslint';
4
-
5
- declare const Neatlint: (options?: NeatlintOptions) => ESLintConfig[];
6
-
7
- export { Neatlint };
@@ -1,132 +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 __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/utils/Neatlint.util.ts
31
- var Neatlint_util_exports = {};
32
- __export(Neatlint_util_exports, {
33
- Neatlint: () => Neatlint
34
- });
35
- module.exports = __toCommonJS(Neatlint_util_exports);
36
- var import_lodash = __toESM(require("lodash"));
37
-
38
- // src/defaults/NeatlintOptions.default.ts
39
- var import_typescript_eslint = __toESM(require("typescript-eslint"));
40
- var import_js = __toESM(require("@eslint/js"));
41
- var NeatlintOptionsDefault = {
42
- disabled: false,
43
- ignores: ["./dist/**"],
44
- javascript: {
45
- files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
46
- languageOptions: {},
47
- plugins: {},
48
- rules: {
49
- ...import_js.default.configs.recommended.rules,
50
- ...Object.assign(
51
- {},
52
- ...import_typescript_eslint.default.configs.strictTypeChecked.map(
53
- (item) => Object.fromEntries(
54
- Object.entries(item.rules ?? {}).filter(([key]) => !key.startsWith("@typescript-eslint")).map(([key]) => [key, "error"])
55
- )
56
- )
57
- ),
58
- ...Object.assign(
59
- {},
60
- ...import_typescript_eslint.default.configs.stylisticTypeChecked.map(
61
- (item) => Object.fromEntries(
62
- Object.entries(item.rules ?? {}).filter(([key]) => !key.startsWith("@typescript-eslint")).map(([key]) => [key, "error"])
63
- )
64
- )
65
- ),
66
- ...import_typescript_eslint.default.configs.eslintRecommended.rules,
67
- "no-undef": "off",
68
- "func-style": ["error", "expression", { allowArrowFunctions: true }],
69
- "no-duplicate-imports": "error",
70
- "no-eval": "error",
71
- "no-restricted-syntax": ["error", "DebuggerStatement", "EmptyStatement", "ForInStatement", "LabeledStatement", "SequenceExpression", "SwitchStatement", "WithStatement"],
72
- "no-useless-call": "error",
73
- "no-useless-computed-key": "error",
74
- "no-useless-concat": "error",
75
- "no-useless-rename": "error",
76
- "no-useless-return": "error",
77
- "object-shorthand": "error",
78
- "prefer-arrow-callback": "error",
79
- "prefer-template": "error",
80
- eqeqeq: "error"
81
- }
82
- },
83
- typescript: {
84
- files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
85
- languageOptions: {
86
- parser: import_typescript_eslint.default.parser,
87
- parserOptions: {
88
- project: "./tsconfig.json",
89
- sourceType: "module"
90
- }
91
- },
92
- plugins: {
93
- "@typescript-eslint": import_typescript_eslint.default.plugin
94
- },
95
- rules: {
96
- ...Object.assign({}, ...import_typescript_eslint.default.configs.strictTypeChecked.map((item) => item.rules ?? {})),
97
- ...Object.assign({}, ...import_typescript_eslint.default.configs.stylisticTypeChecked.map((item) => item.rules ?? {})),
98
- "@typescript-eslint/consistent-type-definitions": ["error", "type"],
99
- // stylisticTypeChecked but different
100
- "@typescript-eslint/consistent-type-exports": "error",
101
- "@typescript-eslint/consistent-type-imports": "error",
102
- "@typescript-eslint/explicit-member-accessibility": "error",
103
- "@typescript-eslint/prefer-readonly": "error",
104
- "@typescript-eslint/strict-boolean-expressions": "error"
105
- }
106
- }
107
- };
108
-
109
- // src/utils/Neatlint.util.ts
110
- var Neatlint = (options = NeatlintOptionsDefault) => {
111
- options = import_lodash.default.merge({}, NeatlintOptionsDefault, options);
112
- return [
113
- { ignores: options.ignores },
114
- {
115
- files: options.javascript?.files,
116
- languageOptions: options.javascript?.languageOptions,
117
- plugins: options.javascript?.plugins,
118
- rules: options.disabled === true ? {} : options.javascript?.rules
119
- },
120
- {
121
- files: options.typescript?.files,
122
- languageOptions: options.typescript?.languageOptions,
123
- plugins: options.typescript?.plugins,
124
- rules: options.disabled === true ? {} : options.typescript?.rules
125
- },
126
- ...options.config && options.config.length !== 0 ? options.config : []
127
- ];
128
- };
129
- // Annotate the CommonJS export names for ESM import in node:
130
- 0 && (module.exports = {
131
- Neatlint
132
- });
@@ -1,97 +0,0 @@
1
- // src/utils/Neatlint.util.ts
2
- import _ from "lodash";
3
-
4
- // src/defaults/NeatlintOptions.default.ts
5
- import TSESLint from "typescript-eslint";
6
- import ESLintJS from "@eslint/js";
7
- var NeatlintOptionsDefault = {
8
- disabled: false,
9
- ignores: ["./dist/**"],
10
- javascript: {
11
- files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
12
- languageOptions: {},
13
- plugins: {},
14
- rules: {
15
- ...ESLintJS.configs.recommended.rules,
16
- ...Object.assign(
17
- {},
18
- ...TSESLint.configs.strictTypeChecked.map(
19
- (item) => Object.fromEntries(
20
- Object.entries(item.rules ?? {}).filter(([key]) => !key.startsWith("@typescript-eslint")).map(([key]) => [key, "error"])
21
- )
22
- )
23
- ),
24
- ...Object.assign(
25
- {},
26
- ...TSESLint.configs.stylisticTypeChecked.map(
27
- (item) => Object.fromEntries(
28
- Object.entries(item.rules ?? {}).filter(([key]) => !key.startsWith("@typescript-eslint")).map(([key]) => [key, "error"])
29
- )
30
- )
31
- ),
32
- ...TSESLint.configs.eslintRecommended.rules,
33
- "no-undef": "off",
34
- "func-style": ["error", "expression", { allowArrowFunctions: true }],
35
- "no-duplicate-imports": "error",
36
- "no-eval": "error",
37
- "no-restricted-syntax": ["error", "DebuggerStatement", "EmptyStatement", "ForInStatement", "LabeledStatement", "SequenceExpression", "SwitchStatement", "WithStatement"],
38
- "no-useless-call": "error",
39
- "no-useless-computed-key": "error",
40
- "no-useless-concat": "error",
41
- "no-useless-rename": "error",
42
- "no-useless-return": "error",
43
- "object-shorthand": "error",
44
- "prefer-arrow-callback": "error",
45
- "prefer-template": "error",
46
- eqeqeq: "error"
47
- }
48
- },
49
- typescript: {
50
- files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
51
- languageOptions: {
52
- parser: TSESLint.parser,
53
- parserOptions: {
54
- project: "./tsconfig.json",
55
- sourceType: "module"
56
- }
57
- },
58
- plugins: {
59
- "@typescript-eslint": TSESLint.plugin
60
- },
61
- rules: {
62
- ...Object.assign({}, ...TSESLint.configs.strictTypeChecked.map((item) => item.rules ?? {})),
63
- ...Object.assign({}, ...TSESLint.configs.stylisticTypeChecked.map((item) => item.rules ?? {})),
64
- "@typescript-eslint/consistent-type-definitions": ["error", "type"],
65
- // stylisticTypeChecked but different
66
- "@typescript-eslint/consistent-type-exports": "error",
67
- "@typescript-eslint/consistent-type-imports": "error",
68
- "@typescript-eslint/explicit-member-accessibility": "error",
69
- "@typescript-eslint/prefer-readonly": "error",
70
- "@typescript-eslint/strict-boolean-expressions": "error"
71
- }
72
- }
73
- };
74
-
75
- // src/utils/Neatlint.util.ts
76
- var Neatlint = (options = NeatlintOptionsDefault) => {
77
- options = _.merge({}, NeatlintOptionsDefault, options);
78
- return [
79
- { ignores: options.ignores },
80
- {
81
- files: options.javascript?.files,
82
- languageOptions: options.javascript?.languageOptions,
83
- plugins: options.javascript?.plugins,
84
- rules: options.disabled === true ? {} : options.javascript?.rules
85
- },
86
- {
87
- files: options.typescript?.files,
88
- languageOptions: options.typescript?.languageOptions,
89
- plugins: options.typescript?.plugins,
90
- rules: options.disabled === true ? {} : options.typescript?.rules
91
- },
92
- ...options.config && options.config.length !== 0 ? options.config : []
93
- ];
94
- };
95
- export {
96
- Neatlint
97
- };