@xsynaptic/eslint-config 3.0.0 → 3.0.1

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/eslint.config.ts CHANGED
@@ -1,3 +1,7 @@
1
1
  import { getConfig } from "./src";
2
2
 
3
- export default getConfig();
3
+ export default getConfig([
4
+ {
5
+ ignores: ["dist/**"],
6
+ },
7
+ ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsynaptic/eslint-config",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "A common ESLint config factory for TypeScript projects",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -25,14 +25,14 @@
25
25
  "eslint-plugin-jsx-a11y": "^6.10.2",
26
26
  "eslint-plugin-perfectionist": "^4.15.0",
27
27
  "eslint-plugin-unicorn": "^61.0.2",
28
- "globals": "^16.3.0",
29
- "prettier": "^3.6.2",
30
- "typescript-eslint": "^8.42.0"
28
+ "globals": "^16.4.0",
29
+ "typescript-eslint": "^8.44.0"
31
30
  },
32
31
  "devDependencies": {
33
32
  "@eslint/config-helpers": "^0.3.1",
34
33
  "jiti": "^2.5.1",
35
- "tsdown": "^0.14.2",
34
+ "prettier": "^3.6.2",
35
+ "tsdown": "^0.15.1",
36
36
  "typescript": "^5.9.2"
37
37
  },
38
38
  "packageManager": "pnpm@10.15.0+sha512.486ebc259d3e999a4e8691ce03b5cac4a71cbeca39372a9b762cb500cfdf0873e2cb16abe3d951b1ee2cf012503f027b98b6584e4df22524e0c7450d9ec7aa7b"
@@ -0,0 +1 @@
1
+ minimumReleaseAge: 1440
package/src/index.ts CHANGED
@@ -85,7 +85,7 @@ export function getConfig(
85
85
  "perfectionist/sort-union-types": "off",
86
86
  },
87
87
  },
88
- ] as Array<ConfigWithExtends>;
88
+ ] as Array<ConfigWithExtends>; // Note: this is a workaround for a type incompatibility
89
89
 
90
90
  return defineConfig(...baseConfig, ...(customConfig ?? []));
91
91
  }
package/dist/index.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import * as eslint0 from "eslint";
2
- import { Config, ConfigWithExtendsArray } from "@eslint/config-helpers";
3
-
4
- //#region src/index.d.ts
5
- declare function getConfig(customConfig?: ConfigWithExtendsArray, options?: {
6
- customGlobals?: Record<string, "readonly" | "writeable">;
7
- parserOptions?: NonNullable<Config["languageOptions"]>["parserOptions"];
8
- }): eslint0.Linter.Config<eslint0.Linter.RulesRecord>[];
9
- //#endregion
10
- export { getConfig };
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- import e from"@eslint/js";import t from"eslint-plugin-perfectionist";import n from"eslint-plugin-unicorn";import r from"globals";import i from"typescript-eslint";const a=[`env`,`extends`,`globals`,`ignorePatterns`,`noInlineConfig`,`overrides`,`parser`,`parserOptions`,`reportUnusedDisableDirectives`,`root`],o=new Set([`basePath`,`ignores`,`name`]);function s(e,t){return e.name?e.name:`UserConfig${t}`}function c(e,t){return typeof e==`string`?e:e.name?e.name:`ExtendedConfig${t}`}function l(e){for(let t of a)if(t in e)return!0;return!1}function u(e){return Object.keys(e).every(e=>o.has(e))}function d(e){let t=e.indexOf(`/`);if(t===-1)return{namespace:``,name:e};let n=e.slice(0,t);if(n[0]===`@`&&n!==`@`){let r=e.indexOf(`/`,t+1);if(r!==-1)return n=e.slice(0,r),{namespace:n,name:e.slice(r+1)}}let r=e.slice(t+1);return{namespace:n,name:r}}function f(e,t,n){let r=t.meta?.namespace;if(!r||r===e||!n.rules&&!n.processor&&!n.language)return n;let i={...n};if(i.rules){let t=Object.keys(i.rules),n={};for(let a=0;a<t.length;a++){let o=t[a],{namespace:s,name:c}=d(o);s===r?n[`${e}/${c}`]=i.rules[o]:n[o]=i.rules[o]}i.rules=n}if(typeof i.processor==`string`){let{namespace:t,name:n}=d(i.processor);t&&t===r&&(i.processor=`${e}/${n}`)}if(typeof i.language==`string`){let{namespace:t,name:n}=d(i.language);t===r&&(i.language=`${e}/${n}`)}return i}function p(e,t,n,r){if(Array.isArray(n))return n.map(n=>p(e,t,n,r));if(l(n))throw TypeError(`Plugin config "${r}" is an eslintrc config and cannot be used in this context.`);return f(e,t,n)}function m(e,t){let{namespace:n,name:r}=d(t),i=e.plugins?.[n];if(!i)throw TypeError(`Plugin "${n}" not found.`);let a=i.configs?.[r];if(a){if(Array.isArray(a)||!l(a))return p(n,i,a,t);let e=i.configs?.[`flat/${r}`];if(e&&(Array.isArray(e)||!l(e)))return p(n,i,e,t);throw TypeError(`Plugin config "${r}" in plugin "${n}" is an eslintrc config and cannot be used in this context.`)}throw TypeError(`Plugin config "${r}" not found in plugin "${n}".`)}function*h(e,t=``){for(let n=0;n<e.length;n++){let r=t?`${t}[${n}]`:`[${n}]`;if(Array.isArray(e[n])){yield*h(e[n],r);continue}yield{indexPath:r,value:e[n]}}}function g(e=[],t=[]){if(!t.length)return e.concat();if(!e.length)return t.concat();let n=[];for(let r of e)for(let e of t){let t=[];Array.isArray(r)?t.push(...r):t.push(r),Array.isArray(e)?t.push(...e):t.push(e),n.push(t)}return n}function _(e,t,n,r){let i={...n};return u(n)||(e.files&&(i.files=g(e.files,n.files)),e.ignores&&(i.ignores=e.ignores.concat(n.ignores??[]))),i.name=`${t} > ${r}`,e.basePath&&(i.basePath=e.basePath),i}function v(e,t){if(!e.extends)return[e];if(!Array.isArray(e.extends))throw TypeError("The `extends` property must be an array.");let{extends:n,...r}=e,i=new WeakMap,a=n.map(t=>{if(typeof t==`string`){let n=m(e,t);return Array.isArray(n)?n.forEach((e,n)=>{i.set(e,`${t}[${n}]`)}):i.set(n,t),n}return t}),o=[];for(let{indexPath:n,value:s}of h(a)){let a=s;if(`basePath`in a)throw TypeError("'basePath' in `extends` is not allowed.");if(`extends`in a)throw TypeError(`Nested 'extends' is not allowed.`);let l=t.get(e),u=i.get(s)??c(s,n);o.push(_(r,l,a,u))}return u(r)||o.push(r),o.flat()}function y(e,t){return e.flatMap(e=>v(e,t))}function b(...e){let t=new WeakMap,n=[];if(e.length===0)throw TypeError(`Expected one or more arguments.`);for(let{indexPath:r,value:i}of h(e)){if(typeof i!=`object`||!i)throw TypeError(`Expected an object but received ${String(i)}.`);let e=i;t.set(e,s(e,r)),n.push(e)}return y(n,t)}function x(a,o){let s=o?.customGlobals??{},c=[e.configs.recommended,...i.configs.strictTypeChecked,...i.configs.stylisticTypeChecked,{languageOptions:{globals:{...r.builtin,...r.nodeBuiltin,...s},parser:i.parser,parserOptions:o?.parserOptions??{projectService:!0,project:[`./tsconfig.json`]}},plugins:{"@typescript-eslint":i.plugin},rules:{"@typescript-eslint/array-type":[`warn`,{default:`generic`}],"@typescript-eslint/no-non-null-assertion":`off`,"@typescript-eslint/no-unused-vars":[`error`,{argsIgnorePattern:`^_`,caughtErrorsIgnorePattern:`^_`,destructuredArrayIgnorePattern:`^_`,ignoreRestSiblings:!0,varsIgnorePattern:`^_`}],"@typescript-eslint/prefer-nullish-coalescing":`off`}},n.configs.recommended,{rules:{"unicorn/filename-case":`warn`,"unicorn/no-array-callback-reference":`off`,"unicorn/prevent-abbreviations":`off`}},{plugins:{perfectionist:t},rules:{...t.configs[`recommended-natural`].rules,"sort-classes":`off`,"perfectionist/sort-imports":[`error`,{type:`natural`,internalPattern:[`^~/.*`,`^@/.*`,`^#.*`]}],"perfectionist/sort-interfaces":`off`,"perfectionist/sort-jsx-props":`off`,"perfectionist/sort-maps":`off`,"perfectionist/sort-modules":`off`,"perfectionist/sort-objects":`off`,"perfectionist/sort-object-types":`off`,"perfectionist/sort-sets":`off`,"perfectionist/sort-switch-case":`off`,"perfectionist/sort-union-types":`off`}}];return b(...c,...a??[])}export{x as getConfig};