@aryaemami59/eslint-config 0.0.4 → 0.0.6

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Arya Emami
3
+ Copyright (c) 2026 Arya Emami
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.cjs CHANGED
@@ -1,256 +1,389 @@
1
- "use strict";
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ //#region \0rolldown/runtime.js
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  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
9
  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;
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) {
14
+ __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ }
20
+ }
21
+ return to;
19
22
  };
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);
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
29
27
 
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- createESLintConfig: () => createESLintConfig,
34
- flatESLintConfig: () => flatESLintConfig,
35
- globalIgnores: () => globalIgnores,
36
- globals: () => globals,
37
- rulesToDisable: () => rulesToDisable,
38
- vitestGlobals: () => vitestGlobals
39
- });
40
- module.exports = __toCommonJS(src_exports);
41
- var import_js = __toESM(require("@eslint/js"), 1);
42
- var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
43
- var import_globals = __toESM(require("globals"), 1);
44
- var import_typescript_eslint = require("typescript-eslint");
45
- var { browser, node, nodeBuiltin } = import_globals.default;
46
- var globalIgnores = {
47
- name: "@aryaemami59/global-ignores",
48
- ignores: [
49
- "**/dist/",
50
- "**/.yalc/",
51
- "**/build/",
52
- "**/lib/",
53
- "**/temp/",
54
- "**/.yarn/",
55
- "**/coverage/"
56
- ]
28
+ //#endregion
29
+ let _eslint_js = require("@eslint/js");
30
+ _eslint_js = __toESM(_eslint_js);
31
+ let eslint_config_prettier_flat = require("eslint-config-prettier/flat");
32
+ eslint_config_prettier_flat = __toESM(eslint_config_prettier_flat);
33
+ let globals = require("globals");
34
+ globals = __toESM(globals);
35
+ let typescript_eslint = require("typescript-eslint");
36
+ let eslint_config = require("eslint/config");
37
+
38
+ //#region src/disabledRules.ts
39
+ /**
40
+ * An object comprised of ESLint rules to disable.
41
+ * These rules are disabled in {@linkcode flatESLintConfig}.
42
+ *
43
+ * @since 0.0.3
44
+ * @public
45
+ */
46
+ const disabledRules = {
47
+ "@typescript-eslint/ban-ts-comment": [0, {
48
+ minimumDescriptionLength: 3,
49
+ "ts-check": false,
50
+ "ts-expect-error": "allow-with-description",
51
+ "ts-ignore": true,
52
+ "ts-nocheck": true
53
+ }],
54
+ "@typescript-eslint/consistent-generic-constructors": [0],
55
+ "@typescript-eslint/no-unused-vars": [0, {
56
+ args: "after-used",
57
+ argsIgnorePattern: "^_",
58
+ caughtErrors: "all",
59
+ caughtErrorsIgnorePattern: "^_",
60
+ destructuredArrayIgnorePattern: "^_",
61
+ ignoreClassWithStaticInitBlock: false,
62
+ ignoreRestSiblings: false,
63
+ reportUsedIgnorePattern: false,
64
+ vars: "all",
65
+ varsIgnorePattern: "^_"
66
+ }],
67
+ "no-undef": [0, { typeof: false }]
57
68
  };
58
- var vitestGlobals = {
59
- suite: "writable",
60
- test: "writable",
61
- describe: "writable",
62
- it: "writable",
63
- expectTypeOf: "writable",
64
- assertType: "writable",
65
- expect: "writable",
66
- assert: "writable",
67
- vitest: "writable",
68
- vi: "writable",
69
- beforeAll: "writable",
70
- afterAll: "writable",
71
- beforeEach: "writable",
72
- afterEach: "writable",
73
- onTestFailed: "writable",
74
- onTestFinished: "writable"
69
+
70
+ //#endregion
71
+ //#region src/external.ts
72
+ const { browser, node, nodeBuiltin, vitest } = globals.default;
73
+
74
+ //#endregion
75
+ //#region package.json
76
+ var name = "@aryaemami59/eslint-config";
77
+
78
+ //#endregion
79
+ //#region src/packageJsonName.ts
80
+ /**
81
+ * This is used because if we import the package name from the
82
+ * `package.json` file, it will be bundled into the final output,
83
+ * which is not desired.
84
+ *
85
+ * @since 0.0.5
86
+ * @internal
87
+ */
88
+ const packageJsonName = name;
89
+
90
+ //#endregion
91
+ //#region src/globalIgnores.ts
92
+ /**
93
+ * An object representing
94
+ * {@link https://eslint.org/docs/latest/use/configure/ignore#ignoring-files | **global ignore patterns**}
95
+ * for ESLint configuration.
96
+ *
97
+ * @since 0.0.3
98
+ * @public
99
+ */
100
+ const globalIgnores = {
101
+ ignores: [
102
+ "**/__snapshots__/",
103
+ "**/.docusaurus/",
104
+ "**/.expo/",
105
+ "**/.next/",
106
+ "**/.playwright/",
107
+ "**/.temp/",
108
+ "**/.tmp/",
109
+ "**/.turbo/",
110
+ "**/.wrangler/",
111
+ "**/.yalc/",
112
+ "**/.yarn/",
113
+ "**/*.snap",
114
+ "**/build/",
115
+ "**/coverage/",
116
+ "**/dist/",
117
+ "**/temp/"
118
+ ],
119
+ name: `${packageJsonName}/global-ignores`
75
120
  };
76
- var globals = /* @__PURE__ */ Object.assign(
77
- vitestGlobals,
78
- browser,
79
- node,
80
- nodeBuiltin
81
- );
82
- var rulesToDisable = {
83
- "no-undef": [0],
84
- "@typescript-eslint/no-unused-vars": [
85
- 0,
86
- {
87
- vars: "all",
88
- args: "after-used",
89
- caughtErrors: "all",
90
- ignoreRestSiblings: false,
91
- reportUsedIgnorePattern: false
92
- }
93
- ],
94
- "@typescript-eslint/ban-ts-comment": [
95
- 0,
96
- [
97
- {
98
- "ts-expect-error": "allow-with-description",
99
- "ts-ignore": true,
100
- "ts-nocheck": true,
101
- "ts-check": false,
102
- minimumDescriptionLength: 3
103
- }
104
- ]
105
- ]
121
+
122
+ //#endregion
123
+ //#region src/globals.ts
124
+ /**
125
+ * An object representing the
126
+ * {@link https://vitest.dev/config/#globals | globals} provided by
127
+ * {@link https://vitest.dev | **Vitest**} for use in testing.
128
+ *
129
+ * @since 0.0.3
130
+ * @public
131
+ */
132
+ const vitestGlobals = {
133
+ afterAll: "writable",
134
+ afterEach: "writable",
135
+ assert: "writable",
136
+ assertType: "writable",
137
+ beforeAll: "writable",
138
+ beforeEach: "writable",
139
+ chai: "writable",
140
+ describe: "writable",
141
+ expect: "writable",
142
+ expectTypeOf: "writable",
143
+ it: "writable",
144
+ onTestFailed: "writable",
145
+ onTestFinished: "writable",
146
+ suite: "writable",
147
+ test: "writable",
148
+ vi: "writable",
149
+ vitest: "writable"
106
150
  };
107
- var flatESLintConfig = /* @__PURE__ */ (0, import_typescript_eslint.config)(
108
- // `ignores` must be first.
109
- // config with just `ignores` is the replacement for `.eslintignore`
110
- globalIgnores,
111
- { name: "@aryaemami59/javascript", ...import_js.default.configs.recommended },
112
- ...import_typescript_eslint.configs.recommended,
113
- ...import_typescript_eslint.configs.stylistic,
114
- { name: "@aryaemami59/prettier-config", ...import_eslint_config_prettier.default },
115
- {
116
- name: "@aryaemami59/main",
117
- languageOptions: {
118
- globals,
119
- parser: import_typescript_eslint.parser,
120
- parserOptions: {
121
- projectService: {
122
- allowDefaultProject: [".*.js", ".*.mjs", ".*.cjs"],
123
- defaultProject: "./tsconfig.json"
124
- },
125
- ecmaVersion: "latest"
126
- }
127
- },
128
- rules: {
129
- "@typescript-eslint/consistent-type-imports": [
130
- 2,
131
- {
132
- prefer: "type-imports",
133
- fixStyle: "separate-type-imports",
134
- disallowTypeAnnotations: true
135
- }
136
- ],
137
- "@typescript-eslint/consistent-type-exports": [
138
- 2,
139
- { fixMixedExportsWithInlineTypeSpecifier: false }
140
- ],
141
- "@typescript-eslint/no-explicit-any": [
142
- 2,
143
- { fixToUnknown: false, ignoreRestArgs: false }
144
- ],
145
- "@typescript-eslint/no-empty-object-type": [
146
- 2,
147
- { allowInterfaces: "never", allowObjectTypes: "never" }
148
- ],
149
- "@typescript-eslint/no-restricted-types": [
150
- 2,
151
- {
152
- types: {
153
- "{}": {
154
- message: `
155
- - If you want to represent an empty object, use \`type EmptyObject = Record<string, never>\`.
156
- - If you want to represent an object literal, use either \`type AnyObject = Record<string, any>\` or \`object\`.
157
- - If you want to represent any non-nullish value, use \`type AnyNonNullishValue = NonNullable<unknown>\`.`,
158
- suggest: [
159
- "AnyNonNullishValue",
160
- "EmptyObject",
161
- "AnyObject",
162
- "object",
163
- "Record<string, never>",
164
- "Record<string, any>",
165
- "NonNullable<unknown>"
166
- ]
167
- }
168
- }
169
- }
170
- ],
171
- "@typescript-eslint/no-namespace": [
172
- 2,
173
- { allowDeclarations: false, allowDefinitionFiles: true }
174
- ],
175
- "@typescript-eslint/consistent-type-definitions": [2, "type"],
176
- "sort-imports": [
177
- 2,
178
- {
179
- ignoreCase: false,
180
- ignoreDeclarationSort: true,
181
- ignoreMemberSort: false,
182
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
183
- allowSeparatedGroups: true
184
- }
185
- ],
186
- "@typescript-eslint/unified-signatures": [2],
187
- "@typescript-eslint/dot-notation": [
188
- 2,
189
- {
190
- // Related issue: https://github.com/typescript-eslint/typescript-eslint/issues/10338
191
- // Base ESLint default options
192
- allowKeywords: true,
193
- allowPattern: "",
194
- // TypeScript ESLint default options
195
- allowPrivateClassPropertyAccess: false,
196
- allowProtectedClassPropertyAccess: false,
197
- allowIndexSignaturePropertyAccess: false
198
- }
199
- ],
200
- "@typescript-eslint/no-unnecessary-type-parameters": [2],
201
- "@typescript-eslint/no-invalid-void-type": [2],
202
- "@typescript-eslint/no-confusing-void-expression": [2],
203
- "@typescript-eslint/no-duplicate-type-constituents": [2],
204
- "@typescript-eslint/require-await": [2],
205
- "@typescript-eslint/no-redundant-type-constituents": [2],
206
- "@typescript-eslint/no-unnecessary-type-arguments": [2],
207
- "@typescript-eslint/no-unnecessary-type-assertion": [2],
208
- "@typescript-eslint/prefer-nullish-coalescing": [2],
209
- "@typescript-eslint/no-inferrable-types": [2],
210
- "@typescript-eslint/no-empty-function": [
211
- 2,
212
- {
213
- // Related issue: https://github.com/typescript-eslint/typescript-eslint/issues/10338
214
- // Base ESLint default options
215
- allow: []
216
- }
217
- ],
218
- "@typescript-eslint/no-unused-expressions": [
219
- 2,
220
- {
221
- // Related issue: https://github.com/typescript-eslint/typescript-eslint/issues/10338
222
- // Base ESLint default options
223
- allowShortCircuit: false,
224
- allowTernary: false,
225
- allowTaggedTemplates: false,
226
- enforceForJSX: false
227
- }
228
- ],
229
- "object-shorthand": [2],
230
- ...rulesToDisable
231
- },
232
- linterOptions: { reportUnusedDisableDirectives: 2 }
233
- },
234
- {
235
- name: "@aryaemami59/commonjs",
236
- files: ["**/*.c[jt]s"],
237
- languageOptions: { sourceType: "commonjs" },
238
- rules: {
239
- "@typescript-eslint/no-require-imports": [
240
- 0,
241
- [{ allow: [], allowAsImport: false }]
242
- ]
243
- }
151
+ /**
152
+ * An object that specifies which global
153
+ * variables are available during linting.
154
+ *
155
+ * @since 0.0.3
156
+ * @public
157
+ */
158
+ const globals$1 = /* @__PURE__ */ Object.assign({
159
+ ...browser,
160
+ ...node,
161
+ ...nodeBuiltin
162
+ }, {
163
+ ...vitest,
164
+ ...vitestGlobals
165
+ });
166
+
167
+ //#endregion
168
+ //#region src/shareableConfigs.ts
169
+ /**
170
+ * Flat ESLint configuration tailored for projects using TypeScript.
171
+ *
172
+ * @example
173
+ * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`__</caption>
174
+ *
175
+ * ```ts
176
+ * import { flatESLintConfig } from '@aryaemami59/eslint-config'
177
+ *
178
+ * export default flatESLintConfig
179
+ * ```
180
+ *
181
+ * @example
182
+ * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)__</caption>
183
+ *
184
+ * ```ts
185
+ * const { flatESLintConfig } = require('@aryaemami59/eslint-config')
186
+ *
187
+ * module.exports = flatESLintConfig
188
+ * ```
189
+ *
190
+ * @example
191
+ * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cjs` or `eslint.config.cts` (using dynamic import)__</caption>
192
+ *
193
+ * ```ts
194
+ * module.exports = (async () =>
195
+ * (await import('@aryaemami59/eslint-config')).flatESLintConfig)()
196
+ * ```
197
+ *
198
+ * @example
199
+ * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)__</caption>
200
+ *
201
+ * ```ts
202
+ * import eslintConfigModule = require('@aryaemami59/eslint-config')
203
+ * import flatESLintConfig = eslintConfigModule.flatESLintConfig
204
+ *
205
+ * export = flatESLintConfig
206
+ * ```
207
+ *
208
+ * @since 0.0.3
209
+ * @public
210
+ */
211
+ const flatESLintConfig = [
212
+ globalIgnores,
213
+ {
214
+ name: `${_eslint_js.default.meta.name}/recommended`,
215
+ ..._eslint_js.default.configs.recommended
216
+ },
217
+ {
218
+ languageOptions: {
219
+ globals: globals$1,
220
+ parserOptions: {
221
+ ecmaVersion: "latest",
222
+ projectService: true
223
+ }
224
+ },
225
+ linterOptions: {
226
+ reportUnusedDisableDirectives: 2,
227
+ reportUnusedInlineConfigs: 2
228
+ },
229
+ name: `${packageJsonName}/defaults/overrides`,
230
+ rules: {
231
+ "object-shorthand": [
232
+ 2,
233
+ "always",
234
+ {
235
+ avoidExplicitReturnArrows: true,
236
+ avoidQuotes: true,
237
+ ignoreConstructors: true,
238
+ methodsIgnorePattern: ""
239
+ }
240
+ ],
241
+ "sort-imports": [2, {
242
+ allowSeparatedGroups: true,
243
+ ignoreCase: false,
244
+ ignoreDeclarationSort: true,
245
+ ignoreMemberSort: false,
246
+ memberSyntaxSortOrder: [
247
+ "none",
248
+ "all",
249
+ "multiple",
250
+ "single"
251
+ ]
252
+ }],
253
+ ...disabledRules
254
+ }
255
+ },
256
+ {
257
+ files: ["**/*.cjs"],
258
+ languageOptions: { sourceType: "commonjs" },
259
+ name: `${packageJsonName}/commonjs-files`,
260
+ rules: { "@typescript-eslint/no-require-imports": [0, {
261
+ allow: [],
262
+ allowAsImport: false
263
+ }] }
264
+ },
265
+ eslint_config_prettier_flat.default
266
+ ];
267
+
268
+ //#endregion
269
+ //#region src/utils.ts
270
+ /**
271
+ * A function that returns {@linkcode flatESLintConfig}
272
+ * along with optional additional overrides.
273
+ * It's made mainly to provide intellisense and eliminate
274
+ * the need for manual type annotations using JSDoc comments.
275
+ *
276
+ * @param [additionalOverrides=[]] - **Optional** additional overrides to apply to the configuration.
277
+ * @returns An augmented version of the default {@linkcode flatESLintConfig}, incorporating any provided overrides.
278
+ *
279
+ * @example
280
+ * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`__</caption>
281
+ *
282
+ * ```ts
283
+ * import { createESLintConfig } from '@aryaemami59/eslint-config'
284
+ *
285
+ * export default createESLintConfig([
286
+ * {
287
+ * rules: {
288
+ * 'no-console': [0],
289
+ * },
290
+ * },
291
+ * {
292
+ * // ...Other additional overrides
293
+ * },
294
+ * ])
295
+ * ```
296
+ *
297
+ * @example
298
+ * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)__</caption>
299
+ *
300
+ * ```ts
301
+ * const { createESLintConfig } = require('@aryaemami59/eslint-config')
302
+ *
303
+ * module.exports = createESLintConfig([
304
+ * {
305
+ * rules: {
306
+ * 'no-console': [0],
307
+ * },
308
+ * },
309
+ * {
310
+ * // ...Other additional overrides
311
+ * },
312
+ * ])
313
+ * ```
314
+ *
315
+ * @example
316
+ * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using dynamic import)__</caption>
317
+ *
318
+ * ```ts
319
+ * module.exports = (async () =>
320
+ * (await import('@aryaemami59/eslint-config')).createESLintConfig([
321
+ * {
322
+ * rules: {
323
+ * 'no-console': [0],
324
+ * },
325
+ * },
326
+ * {
327
+ * // ...Other additional overrides
328
+ * },
329
+ * ]))()
330
+ * ```
331
+ *
332
+ * @example
333
+ * <caption>#### __CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)__</caption>
334
+ *
335
+ * ```ts
336
+ * import eslintConfigModule = require('@aryaemami59/eslint-config')
337
+ * import createESLintConfig = eslintConfigModule.createESLintConfig
338
+ *
339
+ * export = createESLintConfig([
340
+ * {
341
+ * rules: {
342
+ * 'no-console': [0],
343
+ * },
344
+ * },
345
+ * {
346
+ * // ...Other additional overrides
347
+ * },
348
+ * ])
349
+ * ```
350
+ *
351
+ * @since 0.0.3
352
+ * @public
353
+ */
354
+ const createESLintConfig = (additionalOverrides = []) => /* @__PURE__ */ (0, eslint_config.defineConfig)(...flatESLintConfig, ...additionalOverrides);
355
+
356
+ //#endregion
357
+ Object.defineProperty(exports, 'config', {
358
+ enumerable: true,
359
+ get: function () {
360
+ return typescript_eslint.config;
361
+ }
362
+ });
363
+ Object.defineProperty(exports, 'configs', {
364
+ enumerable: true,
365
+ get: function () {
366
+ return typescript_eslint.configs;
367
+ }
368
+ });
369
+ exports.createESLintConfig = createESLintConfig;
370
+ exports.disabledRules = disabledRules;
371
+ exports.flatESLintConfig = flatESLintConfig;
372
+ exports.globalIgnores = globalIgnores;
373
+ exports.globals = globals$1;
374
+ exports.js = _eslint_js.default;
375
+ Object.defineProperty(exports, 'parser', {
376
+ enumerable: true,
377
+ get: function () {
378
+ return typescript_eslint.parser;
379
+ }
380
+ });
381
+ Object.defineProperty(exports, 'plugin', {
382
+ enumerable: true,
383
+ get: function () {
384
+ return typescript_eslint.plugin;
244
385
  }
245
- );
246
- var createESLintConfig = (additionalOverrides = []) => /* @__PURE__ */ (0, import_typescript_eslint.config)(...flatESLintConfig, ...additionalOverrides);
247
- // Annotate the CommonJS export names for ESM import in node:
248
- 0 && (module.exports = {
249
- createESLintConfig,
250
- flatESLintConfig,
251
- globalIgnores,
252
- globals,
253
- rulesToDisable,
254
- vitestGlobals
255
386
  });
387
+ exports.prettierConfig = eslint_config_prettier_flat.default;
388
+ exports.vitestGlobals = vitestGlobals;
256
389
  //# sourceMappingURL=index.cjs.map