@xsynaptic/eslint-config 3.4.0 → 3.5.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.
package/dist/index.d.mts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { Config, ConfigWithExtends, ConfigWithExtendsArray } from "@eslint/config-helpers";
2
2
 
3
3
  //#region src/index.d.ts
4
- declare function getWebComponentConfig(files: Array<string>): ConfigWithExtends;
5
4
  declare function getConfig(customConfig?: ConfigWithExtendsArray, options?: {
6
5
  customGlobals?: Record<string, 'readonly' | 'writeable'>;
7
6
  parserOptions?: NonNullable<Config['languageOptions']>['parserOptions'];
8
7
  }): ConfigWithExtendsArray;
8
+ declare function getWebComponentConfig(files: Array<string>): ConfigWithExtends;
9
9
  //#endregion
10
10
  export { getConfig, getWebComponentConfig };
11
11
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -6,23 +6,6 @@ import { configs } from "eslint-plugin-wc";
6
6
  import globals from "globals";
7
7
  import tseslint from "typescript-eslint";
8
8
  //#region src/index.ts
9
- function getWebComponentConfig(files) {
10
- const bestPractice = configs["flat/best-practice"];
11
- return {
12
- ...bestPractice,
13
- files,
14
- rules: {
15
- ...bestPractice?.rules,
16
- "wc/define-tag-after-class-definition": "error",
17
- "wc/guard-define-call": "error",
18
- "wc/max-elements-per-file": "error",
19
- "wc/no-child-traversal-in-connectedcallback": "off",
20
- "wc/no-constructor": "error",
21
- "wc/no-exports-with-element": "error",
22
- "wc/no-method-prefixed-with-on": "error"
23
- }
24
- };
25
- }
26
9
  function getConfig(customConfig, options) {
27
10
  const customGlobals = options?.customGlobals ?? {};
28
11
  return defineConfig(...[
@@ -42,6 +25,10 @@ function getConfig(customConfig, options) {
42
25
  plugins: { "@typescript-eslint": tseslint.plugin },
43
26
  rules: {
44
27
  "@typescript-eslint/array-type": ["warn", { default: "generic" }],
28
+ "@typescript-eslint/consistent-type-imports": ["error", {
29
+ fixStyle: "separate-type-imports",
30
+ prefer: "type-imports"
31
+ }],
45
32
  "@typescript-eslint/no-non-null-assertion": "off",
46
33
  "@typescript-eslint/no-unused-vars": ["error", {
47
34
  argsIgnorePattern: "^_",
@@ -50,10 +37,6 @@ function getConfig(customConfig, options) {
50
37
  ignoreRestSiblings: true,
51
38
  varsIgnorePattern: "^_"
52
39
  }],
53
- "@typescript-eslint/consistent-type-imports": ["error", {
54
- fixStyle: "separate-type-imports",
55
- prefer: "type-imports"
56
- }],
57
40
  "@typescript-eslint/prefer-nullish-coalescing": "off",
58
41
  "no-restricted-syntax": ["error", {
59
42
  message: "Separate type imports into their own `import type` statement.",
@@ -65,34 +48,29 @@ function getConfig(customConfig, options) {
65
48
  { rules: {
66
49
  "unicorn/filename-case": "warn",
67
50
  "unicorn/no-array-callback-reference": "off",
51
+ "unicorn/number-literal-case": ["error", { hexadecimalValue: "lowercase" }],
68
52
  "unicorn/prevent-abbreviations": "off"
69
53
  } },
70
- {
71
- plugins: { perfectionist },
72
- rules: {
73
- "perfectionist/sort-classes": "off",
74
- "perfectionist/sort-imports": ["error", {
75
- type: "natural",
76
- order: "asc",
77
- internalPattern: [
78
- "^~/.*",
79
- "^@/.*",
80
- "^#.*"
81
- ]
82
- }],
83
- "perfectionist/sort-interfaces": "off",
84
- "perfectionist/sort-jsx-props": "off",
85
- "perfectionist/sort-maps": "off",
86
- "perfectionist/sort-modules": "off",
87
- "perfectionist/sort-objects": "off",
88
- "perfectionist/sort-object-types": "off",
89
- "perfectionist/sort-sets": "off",
90
- "perfectionist/sort-switch-case": "off",
91
- "perfectionist/sort-union-types": "off"
92
- }
93
- }
54
+ perfectionist.configs["recommended-natural"]
94
55
  ], ...customConfig ?? []);
95
56
  }
57
+ function getWebComponentConfig(files) {
58
+ const bestPractice = configs["flat/best-practice"];
59
+ return {
60
+ ...bestPractice,
61
+ files,
62
+ rules: {
63
+ ...bestPractice?.rules,
64
+ "wc/define-tag-after-class-definition": "error",
65
+ "wc/guard-define-call": "error",
66
+ "wc/max-elements-per-file": "error",
67
+ "wc/no-child-traversal-in-connectedcallback": "off",
68
+ "wc/no-constructor": "error",
69
+ "wc/no-exports-with-element": "error",
70
+ "wc/no-method-prefixed-with-on": "error"
71
+ }
72
+ };
73
+ }
96
74
  //#endregion
97
75
  export { getConfig, getWebComponentConfig };
98
76
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["webComponentConfigs"],"sources":["../src/index.ts"],"sourcesContent":["import type { Config, ConfigWithExtends, ConfigWithExtendsArray } from '@eslint/config-helpers';\n\nimport { defineConfig } from '@eslint/config-helpers';\nimport eslint from '@eslint/js';\nimport perfectionist from 'eslint-plugin-perfectionist';\nimport unicornPlugin from 'eslint-plugin-unicorn';\nimport { configs as webComponentConfigs } from 'eslint-plugin-wc';\nimport globals from 'globals';\nimport tseslint from 'typescript-eslint';\n\n// Opt-in rules for authoring native web components\nexport function getWebComponentConfig(files: Array<string>): ConfigWithExtends {\n\tconst bestPractice = webComponentConfigs['flat/best-practice'];\n\n\treturn {\n\t\t...bestPractice,\n\t\tfiles,\n\t\trules: {\n\t\t\t...bestPractice?.rules,\n\t\t\t'wc/define-tag-after-class-definition': 'error',\n\t\t\t'wc/guard-define-call': 'error',\n\t\t\t'wc/max-elements-per-file': 'error',\n\t\t\t'wc/no-child-traversal-in-connectedcallback': 'off',\n\t\t\t'wc/no-constructor': 'error',\n\t\t\t'wc/no-exports-with-element': 'error',\n\t\t\t'wc/no-method-prefixed-with-on': 'error',\n\t\t},\n\t};\n}\n\nexport function getConfig(\n\tcustomConfig?: ConfigWithExtendsArray,\n\toptions?: {\n\t\tcustomGlobals?: Record<string, 'readonly' | 'writeable'>;\n\t\tparserOptions?: NonNullable<Config['languageOptions']>['parserOptions'];\n\t},\n): ConfigWithExtendsArray {\n\tconst customGlobals = options?.customGlobals ?? {};\n\n\tconst baseConfig = [\n\t\teslint.configs.recommended,\n\t\t...tseslint.configs.strictTypeChecked,\n\t\t...tseslint.configs.stylisticTypeChecked,\n\t\t{\n\t\t\tlanguageOptions: {\n\t\t\t\tglobals: {\n\t\t\t\t\t...globals.builtin,\n\t\t\t\t\t...globals.nodeBuiltin,\n\t\t\t\t\t...customGlobals,\n\t\t\t\t},\n\t\t\t\tparser: tseslint.parser,\n\t\t\t\tparserOptions: options?.parserOptions ?? {\n\t\t\t\t\tprojectService: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\tplugins: {\n\t\t\t\t'@typescript-eslint': tseslint.plugin,\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t'@typescript-eslint/array-type': ['warn', { default: 'generic' }],\n\t\t\t\t'@typescript-eslint/no-non-null-assertion': 'off',\n\t\t\t\t'@typescript-eslint/no-unused-vars': [\n\t\t\t\t\t'error',\n\t\t\t\t\t{\n\t\t\t\t\t\targsIgnorePattern: '^_',\n\t\t\t\t\t\tcaughtErrorsIgnorePattern: '^_',\n\t\t\t\t\t\tdestructuredArrayIgnorePattern: '^_',\n\t\t\t\t\t\tignoreRestSiblings: true,\n\t\t\t\t\t\tvarsIgnorePattern: '^_',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t'@typescript-eslint/consistent-type-imports': [\n\t\t\t\t\t'error',\n\t\t\t\t\t{ fixStyle: 'separate-type-imports', prefer: 'type-imports' },\n\t\t\t\t],\n\t\t\t\t'@typescript-eslint/prefer-nullish-coalescing': 'off',\n\t\t\t\t'no-restricted-syntax': [\n\t\t\t\t\t'error',\n\t\t\t\t\t{\n\t\t\t\t\t\tmessage: 'Separate type imports into their own `import type` statement.',\n\t\t\t\t\t\tselector: 'ImportDeclaration[importKind=\"value\"] ImportSpecifier[importKind=\"type\"]',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\tunicornPlugin.configs.recommended,\n\t\t{\n\t\t\trules: {\n\t\t\t\t'unicorn/filename-case': 'warn',\n\t\t\t\t'unicorn/no-array-callback-reference': 'off', // I prefer this pattern for filtering/sorting content\n\t\t\t\t'unicorn/prevent-abbreviations': 'off', // I *like* abbreviations!\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tplugins: {\n\t\t\t\tperfectionist,\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t'perfectionist/sort-classes': 'off',\n\t\t\t\t'perfectionist/sort-imports': [\n\t\t\t\t\t'error',\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'natural',\n\t\t\t\t\t\torder: 'asc',\n\t\t\t\t\t\tinternalPattern: ['^~/.*', '^@/.*', '^#.*'],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t'perfectionist/sort-interfaces': 'off',\n\t\t\t\t'perfectionist/sort-jsx-props': 'off',\n\t\t\t\t'perfectionist/sort-maps': 'off',\n\t\t\t\t'perfectionist/sort-modules': 'off',\n\t\t\t\t'perfectionist/sort-objects': 'off',\n\t\t\t\t'perfectionist/sort-object-types': 'off',\n\t\t\t\t'perfectionist/sort-sets': 'off',\n\t\t\t\t'perfectionist/sort-switch-case': 'off',\n\t\t\t\t'perfectionist/sort-union-types': 'off',\n\t\t\t},\n\t\t},\n\t] satisfies Array<ConfigWithExtends>;\n\n\treturn defineConfig(...baseConfig, ...(customConfig ?? []));\n}\n"],"mappings":";;;;;;;;AAWA,SAAgB,sBAAsB,OAAyC;CAC9E,MAAM,eAAeA,QAAoB;CAEzC,OAAO;EACN,GAAG;EACH;EACA,OAAO;GACN,GAAG,cAAc;GACjB,wCAAwC;GACxC,wBAAwB;GACxB,4BAA4B;GAC5B,8CAA8C;GAC9C,qBAAqB;GACrB,8BAA8B;GAC9B,iCAAiC;EAClC;CACD;AACD;AAEA,SAAgB,UACf,cACA,SAIyB;CACzB,MAAM,gBAAgB,SAAS,iBAAiB,CAAC;CAmFjD,OAAO,aAAa,GAAG;EAhFtB,OAAO,QAAQ;EACf,GAAG,SAAS,QAAQ;EACpB,GAAG,SAAS,QAAQ;EACpB;GACC,iBAAiB;IAChB,SAAS;KACR,GAAG,QAAQ;KACX,GAAG,QAAQ;KACX,GAAG;IACJ;IACA,QAAQ,SAAS;IACjB,eAAe,SAAS,iBAAiB,EACxC,gBAAgB,KACjB;GACD;GACA,SAAS,EACR,sBAAsB,SAAS,OAChC;GACA,OAAO;IACN,iCAAiC,CAAC,QAAQ,EAAE,SAAS,UAAU,CAAC;IAChE,4CAA4C;IAC5C,qCAAqC,CACpC,SACA;KACC,mBAAmB;KACnB,2BAA2B;KAC3B,gCAAgC;KAChC,oBAAoB;KACpB,mBAAmB;IACpB,CACD;IACA,8CAA8C,CAC7C,SACA;KAAE,UAAU;KAAyB,QAAQ;IAAe,CAC7D;IACA,gDAAgD;IAChD,wBAAwB,CACvB,SACA;KACC,SAAS;KACT,UAAU;IACX,CACD;GACD;EACD;EACA,cAAc,QAAQ;EACtB,EACC,OAAO;GACN,yBAAyB;GACzB,uCAAuC;GACvC,iCAAiC;EAClC,EACD;EACA;GACC,SAAS,EACR,cACD;GACA,OAAO;IACN,8BAA8B;IAC9B,8BAA8B,CAC7B,SACA;KACC,MAAM;KACN,OAAO;KACP,iBAAiB;MAAC;MAAS;MAAS;KAAM;IAC3C,CACD;IACA,iCAAiC;IACjC,gCAAgC;IAChC,2BAA2B;IAC3B,8BAA8B;IAC9B,8BAA8B;IAC9B,mCAAmC;IACnC,2BAA2B;IAC3B,kCAAkC;IAClC,kCAAkC;GACnC;EACD;CAG+B,GAAG,GAAI,gBAAgB,CAAC,CAAE;AAC3D"}
1
+ {"version":3,"file":"index.mjs","names":["webComponentConfigs"],"sources":["../src/index.ts"],"sourcesContent":["import type { Config, ConfigWithExtends, ConfigWithExtendsArray } from '@eslint/config-helpers';\n\nimport { defineConfig } from '@eslint/config-helpers';\nimport eslint from '@eslint/js';\nimport perfectionist from 'eslint-plugin-perfectionist';\nimport unicornPlugin from 'eslint-plugin-unicorn';\nimport { configs as webComponentConfigs } from 'eslint-plugin-wc';\nimport globals from 'globals';\nimport tseslint from 'typescript-eslint';\n\nexport function getConfig(\n\tcustomConfig?: ConfigWithExtendsArray,\n\toptions?: {\n\t\tcustomGlobals?: Record<string, 'readonly' | 'writeable'>;\n\t\tparserOptions?: NonNullable<Config['languageOptions']>['parserOptions'];\n\t},\n): ConfigWithExtendsArray {\n\tconst customGlobals = options?.customGlobals ?? {};\n\n\tconst baseConfig = [\n\t\teslint.configs.recommended,\n\t\t...tseslint.configs.strictTypeChecked,\n\t\t...tseslint.configs.stylisticTypeChecked,\n\t\t{\n\t\t\tlanguageOptions: {\n\t\t\t\tglobals: {\n\t\t\t\t\t...globals.builtin,\n\t\t\t\t\t...globals.nodeBuiltin,\n\t\t\t\t\t...customGlobals,\n\t\t\t\t},\n\t\t\t\tparser: tseslint.parser,\n\t\t\t\tparserOptions: options?.parserOptions ?? {\n\t\t\t\t\tprojectService: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\tplugins: {\n\t\t\t\t'@typescript-eslint': tseslint.plugin,\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t'@typescript-eslint/array-type': ['warn', { default: 'generic' }],\n\t\t\t\t'@typescript-eslint/consistent-type-imports': [\n\t\t\t\t\t'error',\n\t\t\t\t\t{ fixStyle: 'separate-type-imports', prefer: 'type-imports' },\n\t\t\t\t],\n\t\t\t\t'@typescript-eslint/no-non-null-assertion': 'off',\n\t\t\t\t'@typescript-eslint/no-unused-vars': [\n\t\t\t\t\t'error',\n\t\t\t\t\t{\n\t\t\t\t\t\targsIgnorePattern: '^_',\n\t\t\t\t\t\tcaughtErrorsIgnorePattern: '^_',\n\t\t\t\t\t\tdestructuredArrayIgnorePattern: '^_',\n\t\t\t\t\t\tignoreRestSiblings: true,\n\t\t\t\t\t\tvarsIgnorePattern: '^_',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t'@typescript-eslint/prefer-nullish-coalescing': 'off',\n\t\t\t\t'no-restricted-syntax': [\n\t\t\t\t\t'error',\n\t\t\t\t\t{\n\t\t\t\t\t\tmessage: 'Separate type imports into their own `import type` statement.',\n\t\t\t\t\t\tselector: 'ImportDeclaration[importKind=\"value\"] ImportSpecifier[importKind=\"type\"]',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\tunicornPlugin.configs.recommended,\n\t\t{\n\t\t\trules: {\n\t\t\t\t'unicorn/filename-case': 'warn',\n\t\t\t\t'unicorn/no-array-callback-reference': 'off', // I prefer this pattern for filtering/sorting content\n\t\t\t\t'unicorn/number-literal-case': ['error', { hexadecimalValue: 'lowercase' }], // Lowercase hex to match Prettier\n\t\t\t\t'unicorn/prevent-abbreviations': 'off', // I *like* abbreviations!\n\t\t\t},\n\t\t},\n\t\tperfectionist.configs['recommended-natural'],\n\t] satisfies Array<ConfigWithExtends>;\n\n\treturn defineConfig(...baseConfig, ...(customConfig ?? []));\n}\n\n// Opt-in rules for authoring native web components\nexport function getWebComponentConfig(files: Array<string>): ConfigWithExtends {\n\tconst bestPractice = webComponentConfigs['flat/best-practice'];\n\n\treturn {\n\t\t...bestPractice,\n\t\tfiles,\n\t\trules: {\n\t\t\t...bestPractice?.rules,\n\t\t\t'wc/define-tag-after-class-definition': 'error',\n\t\t\t'wc/guard-define-call': 'error',\n\t\t\t'wc/max-elements-per-file': 'error',\n\t\t\t'wc/no-child-traversal-in-connectedcallback': 'off',\n\t\t\t'wc/no-constructor': 'error',\n\t\t\t'wc/no-exports-with-element': 'error',\n\t\t\t'wc/no-method-prefixed-with-on': 'error',\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,UACf,cACA,SAIyB;CACzB,MAAM,gBAAgB,SAAS,iBAAiB,CAAC;CA4DjD,OAAO,aAAa,GAAG;EAzDtB,OAAO,QAAQ;EACf,GAAG,SAAS,QAAQ;EACpB,GAAG,SAAS,QAAQ;EACpB;GACC,iBAAiB;IAChB,SAAS;KACR,GAAG,QAAQ;KACX,GAAG,QAAQ;KACX,GAAG;IACJ;IACA,QAAQ,SAAS;IACjB,eAAe,SAAS,iBAAiB,EACxC,gBAAgB,KACjB;GACD;GACA,SAAS,EACR,sBAAsB,SAAS,OAChC;GACA,OAAO;IACN,iCAAiC,CAAC,QAAQ,EAAE,SAAS,UAAU,CAAC;IAChE,8CAA8C,CAC7C,SACA;KAAE,UAAU;KAAyB,QAAQ;IAAe,CAC7D;IACA,4CAA4C;IAC5C,qCAAqC,CACpC,SACA;KACC,mBAAmB;KACnB,2BAA2B;KAC3B,gCAAgC;KAChC,oBAAoB;KACpB,mBAAmB;IACpB,CACD;IACA,gDAAgD;IAChD,wBAAwB,CACvB,SACA;KACC,SAAS;KACT,UAAU;IACX,CACD;GACD;EACD;EACA,cAAc,QAAQ;EACtB,EACC,OAAO;GACN,yBAAyB;GACzB,uCAAuC;GACvC,+BAA+B,CAAC,SAAS,EAAE,kBAAkB,YAAY,CAAC;GAC1E,iCAAiC;EAClC,EACD;EACA,cAAc,QAAQ;CAGS,GAAG,GAAI,gBAAgB,CAAC,CAAE;AAC3D;AAGA,SAAgB,sBAAsB,OAAyC;CAC9E,MAAM,eAAeA,QAAoB;CAEzC,OAAO;EACN,GAAG;EACH;EACA,OAAO;GACN,GAAG,cAAc;GACjB,wCAAwC;GACxC,wBAAwB;GACxB,4BAA4B;GAC5B,8CAA8C;GAC9C,qBAAqB;GACrB,8BAA8B;GAC9B,iCAAiC;EAClC;CACD;AACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsynaptic/eslint-config",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "An ESLint config factory for TypeScript projects",
5
5
  "type": "module",
6
6
  "license": "MIT",