@nzyme/eslint 0.6.2 → 0.8.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.
@@ -0,0 +1,10 @@
1
+ import { Linter } from 'eslint';
2
+ export interface ImportGroup {
3
+ pattern: string;
4
+ group: 'builtin' | 'external' | 'internal' | 'parent' | 'sibling' | 'index';
5
+ position?: 'before' | 'after';
6
+ }
7
+ export interface ImportsOptions {
8
+ groups?: ImportGroup[];
9
+ }
10
+ export declare function imports(options?: ImportsOptions): Linter.Config[];
@@ -0,0 +1,42 @@
1
+ import importsPlugin from 'eslint-plugin-import';
2
+ export function imports(options = {}) {
3
+ return [
4
+ importsPlugin.flatConfigs.recommended,
5
+ importsPlugin.flatConfigs.typescript,
6
+ {
7
+ rules: {
8
+ 'sort-imports': [
9
+ 'warn',
10
+ {
11
+ ignoreCase: false,
12
+ ignoreDeclarationSort: true,
13
+ ignoreMemberSort: false,
14
+ allowSeparatedGroups: true,
15
+ },
16
+ ],
17
+ 'import/order': [
18
+ 'warn',
19
+ {
20
+ 'newlines-between': 'always',
21
+ groups: ['builtin', 'external', 'internal', ['parent', 'sibling'], 'index'],
22
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md#pathgroups-array-of-objects
23
+ pathGroups: options.groups ?? [
24
+ {
25
+ pattern: '@nzyme/**',
26
+ group: 'internal',
27
+ position: 'before',
28
+ },
29
+ ],
30
+ pathGroupsExcludedImportTypes: ['builtin'],
31
+ alphabetize: {
32
+ order: 'asc',
33
+ },
34
+ },
35
+ ],
36
+ // we have TypeScript handling that
37
+ 'import/no-unresolved': 'off',
38
+ },
39
+ },
40
+ ];
41
+ }
42
+ //# sourceMappingURL=imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/imports.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAYjD,MAAM,UAAU,OAAO,CAAC,UAA0B,EAAE;IAChD,OAAO;QACH,aAAa,CAAC,WAAW,CAAC,WAAW;QACrC,aAAa,CAAC,WAAW,CAAC,UAAU;QACpC;YACI,KAAK,EAAE;gBACH,cAAc,EAAE;oBACZ,MAAM;oBACN;wBACI,UAAU,EAAE,KAAK;wBACjB,qBAAqB,EAAE,IAAI;wBAC3B,gBAAgB,EAAE,KAAK;wBACvB,oBAAoB,EAAE,IAAI;qBAC7B;iBACJ;gBACD,cAAc,EAAE;oBACZ,MAAM;oBACN;wBACI,kBAAkB,EAAE,QAAQ;wBAC5B,MAAM,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC;wBAC3E,gHAAgH;wBAChH,UAAU,EAAE,OAAO,CAAC,MAAM,IAAI;4BAC1B;gCACI,OAAO,EAAE,WAAW;gCACpB,KAAK,EAAE,UAAU;gCACjB,QAAQ,EAAE,QAAQ;6BACrB;yBACJ;wBACD,6BAA6B,EAAE,CAAC,SAAS,CAAC;wBAC1C,WAAW,EAAE;4BACT,KAAK,EAAE,KAAK;yBACf;qBACJ;iBACJ;gBACD,mCAAmC;gBACnC,sBAAsB,EAAE,KAAK;aAChC;SACJ;KACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './jsdoc.js';
2
+ export * from './typescript.js';
3
+ export * from './imports.js';
4
+ export * from './vue.js';
@@ -0,0 +1,5 @@
1
+ export * from './jsdoc.js';
2
+ export * from './typescript.js';
3
+ export * from './imports.js';
4
+ export * from './vue.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Linter } from 'eslint';
2
+ export declare function jsdoc(): Linter.Config[];
@@ -0,0 +1,37 @@
1
+ import jsdocPlugin from 'eslint-plugin-jsdoc';
2
+ export function jsdoc() {
3
+ return [
4
+ {
5
+ plugins: {
6
+ jsdoc: jsdocPlugin,
7
+ },
8
+ rules: {
9
+ 'jsdoc/require-jsdoc': [
10
+ 1,
11
+ {
12
+ publicOnly: {
13
+ esm: true,
14
+ cjs: false,
15
+ },
16
+ contexts: [
17
+ 'ClassDeclaration',
18
+ 'ClassProperty',
19
+ 'FunctionDeclaration',
20
+ 'MethodDefinition',
21
+ 'ExportNamedDeclaration > VariableDeclaration',
22
+ 'TSDeclareFunction',
23
+ 'TSEnumDeclaration',
24
+ 'TSInterfaceDeclaration',
25
+ 'TSMethodSignature',
26
+ ':not(TSTypeParameterDeclaration) TSPropertySignature',
27
+ 'TSTypeAliasDeclaration',
28
+ ],
29
+ },
30
+ ],
31
+ 'jsdoc/no-blank-block-descriptions': 'warn',
32
+ 'jsdoc/no-blank-blocks': 'warn',
33
+ },
34
+ },
35
+ ];
36
+ }
37
+ //# sourceMappingURL=jsdoc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsdoc.js","sourceRoot":"","sources":["../../src/jsdoc.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAI9C,MAAM,UAAU,KAAK;IACjB,OAAO;QACH;YACI,OAAO,EAAE;gBACL,KAAK,EAAE,WAAW;aACrB;YAED,KAAK,EAAE;gBACH,qBAAqB,EAAE;oBACnB,CAAC;oBACD;wBACI,UAAU,EAAE;4BACR,GAAG,EAAE,IAAI;4BACT,GAAG,EAAE,KAAK;yBACb;wBAED,QAAQ,EAAE;4BACN,kBAAkB;4BAClB,eAAe;4BACf,qBAAqB;4BACrB,kBAAkB;4BAClB,8CAA8C;4BAC9C,mBAAmB;4BACnB,mBAAmB;4BACnB,wBAAwB;4BACxB,mBAAmB;4BACnB,sDAAsD;4BACtD,wBAAwB;yBAC3B;qBACJ;iBACJ;gBAED,mCAAmC,EAAE,MAAM;gBAC3C,uBAAuB,EAAE,MAAM;aAClC;SACJ;KACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,5 @@
1
+ export type Target = 'node' | 'browser';
2
+ export interface TypescriptOptions {
3
+ target?: Target[] | Target;
4
+ }
5
+ export declare function typescript(options?: TypescriptOptions): import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
@@ -0,0 +1,62 @@
1
+ import workspaces from 'eslint-plugin-workspaces';
2
+ import monorepo from 'eslint-plugin-monorepo';
3
+ import globals from 'globals';
4
+ import js from '@eslint/js';
5
+ import tseslint from 'typescript-eslint';
6
+ import prettier from 'eslint-config-prettier';
7
+ export function typescript(options = {}) {
8
+ const config = {
9
+ ignores: ['dist/**/*', 'node_modules/**/*'],
10
+ files: ['**/*.{ts,tsx}'],
11
+ plugins: {
12
+ workspaces,
13
+ monorepo,
14
+ },
15
+ rules: {
16
+ curly: 'error',
17
+ 'require-await': 'error',
18
+ '@typescript-eslint/no-unused-vars': [
19
+ 'error',
20
+ {
21
+ args: 'all',
22
+ argsIgnorePattern: '^_',
23
+ caughtErrors: 'all',
24
+ caughtErrorsIgnorePattern: '^_',
25
+ destructuredArrayIgnorePattern: '^_',
26
+ varsIgnorePattern: '^_',
27
+ },
28
+ ],
29
+ '@typescript-eslint/consistent-type-imports': 'error',
30
+ '@typescript-eslint/no-import-type-side-effects': 'error',
31
+ 'workspaces/no-relative-imports': 'error',
32
+ 'workspaces/no-absolute-imports': 'error',
33
+ 'workspaces/require-dependency': 'error',
34
+ 'monorepo/no-relative-import': 'error',
35
+ },
36
+ };
37
+ if (Array.isArray(options.target)) {
38
+ config.languageOptions = {
39
+ ...config.languageOptions,
40
+ globals: options.target.reduce((acc, target) => ({ ...acc, ...getTargetGlobals(target) }), {}),
41
+ };
42
+ }
43
+ else if (options.target) {
44
+ config.languageOptions = {
45
+ ...config.languageOptions,
46
+ globals: getTargetGlobals(options.target),
47
+ };
48
+ }
49
+ return tseslint.config({
50
+ extends: [js.configs.recommended, ...tseslint.configs.recommended, prettier],
51
+ ...config,
52
+ });
53
+ }
54
+ function getTargetGlobals(target) {
55
+ switch (target) {
56
+ case 'node':
57
+ return globals.node;
58
+ case 'browser':
59
+ return globals.browser;
60
+ }
61
+ }
62
+ //# sourceMappingURL=typescript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../src/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAS9C,MAAM,UAAU,UAAU,CAAC,UAA6B,EAAE;IACtD,MAAM,MAAM,GAAkB;QAC1B,OAAO,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;QAC3C,KAAK,EAAE,CAAC,eAAe,CAAC;QACxB,OAAO,EAAE;YACL,UAAU;YACV,QAAQ;SACX;QACD,KAAK,EAAE;YACH,KAAK,EAAE,OAAO;YACd,eAAe,EAAE,OAAO;YACxB,mCAAmC,EAAE;gBACjC,OAAO;gBACP;oBACI,IAAI,EAAE,KAAK;oBACX,iBAAiB,EAAE,IAAI;oBACvB,YAAY,EAAE,KAAK;oBACnB,yBAAyB,EAAE,IAAI;oBAC/B,8BAA8B,EAAE,IAAI;oBACpC,iBAAiB,EAAE,IAAI;iBAC1B;aACJ;YACD,4CAA4C,EAAE,OAAO;YACrD,gDAAgD,EAAE,OAAO;YACzD,gCAAgC,EAAE,OAAO;YACzC,gCAAgC,EAAE,OAAO;YACzC,+BAA+B,EAAE,OAAO;YACxC,6BAA6B,EAAE,OAAO;SACzC;KACJ,CAAC;IAEF,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,MAAM,CAAC,eAAe,GAAG;YACrB,GAAG,MAAM,CAAC,eAAe;YACzB,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAC1B,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,GAAG,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,EAC1D,EAAE,CACL;SACJ,CAAC;IACN,CAAC;SAAM,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACxB,MAAM,CAAC,eAAe,GAAG;YACrB,GAAG,MAAM,CAAC,eAAe;YACzB,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC;SAC5C,CAAC;IACN,CAAC;IAED,OAAO,QAAQ,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC;QAC5E,GAAG,MAAM;KACZ,CAAC,CAAC;AACP,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAc;IACpC,QAAQ,MAAM,EAAE,CAAC;QACb,KAAK,MAAM;YACP,OAAO,OAAO,CAAC,IAAI,CAAC;QACxB,KAAK,SAAS;YACV,OAAO,OAAO,CAAC,OAAO,CAAC;IAC/B,CAAC;AACL,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function vue(): import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
@@ -0,0 +1,27 @@
1
+ import pluginVue from 'eslint-plugin-vue';
2
+ import tseslint from 'typescript-eslint';
3
+ export function vue() {
4
+ return tseslint.config({
5
+ extends: [pluginVue.configs['flat/recommended']],
6
+ rules: {
7
+ 'vue/multi-word-component-names': 'off',
8
+ // Not needed in vue 3
9
+ 'vue/require-v-for-key': 'off',
10
+ 'vue/require-default-prop': 'off',
11
+ 'vue/one-component-per-file': 'off',
12
+ // allow importing h from vue for jsx
13
+ '@typescript-eslint/no-unused-vars': [
14
+ 'error',
15
+ {
16
+ args: 'all',
17
+ argsIgnorePattern: '^_',
18
+ caughtErrors: 'all',
19
+ caughtErrorsIgnorePattern: '^_',
20
+ destructuredArrayIgnorePattern: '^_',
21
+ varsIgnorePattern: '(^_)|(^h$)',
22
+ },
23
+ ],
24
+ },
25
+ });
26
+ }
27
+ //# sourceMappingURL=vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue.js","sourceRoot":"","sources":["../../src/vue.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAEzC,MAAM,UAAU,GAAG;IACf,OAAO,QAAQ,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAChD,KAAK,EAAE;YACH,gCAAgC,EAAE,KAAK;YACvC,sBAAsB;YACtB,uBAAuB,EAAE,KAAK;YAC9B,0BAA0B,EAAE,KAAK;YACjC,4BAA4B,EAAE,KAAK;YACnC,qCAAqC;YACrC,mCAAmC,EAAE;gBACjC,OAAO;gBACP;oBACI,IAAI,EAAE,KAAK;oBACX,iBAAiB,EAAE,IAAI;oBACvB,YAAY,EAAE,KAAK;oBACnB,yBAAyB,EAAE,IAAI;oBAC/B,8BAA8B,EAAE,IAAI;oBACpC,iBAAiB,EAAE,YAAY;iBAClC;aACJ;SACJ;KACJ,CAAC,CAAC;AACP,CAAC"}
package/package.json CHANGED
@@ -1,30 +1,43 @@
1
1
  {
2
2
  "name": "@nzyme/eslint",
3
- "version": "0.6.2",
3
+ "version": "0.8.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/kedrzu/nzyme.git"
8
8
  },
9
9
  "author": "Michał Kędrzyński <m.kedrzynski@gmail.com>",
10
- "type": "module",
11
10
  "publishConfig": {
12
11
  "access": "public"
13
12
  },
13
+ "type": "module",
14
14
  "sideEffects": false,
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "exports": {
19
+ ".": {
20
+ "import": "./dist/esm/index.js",
21
+ "types": "./dist/esm/index.d.ts"
22
+ }
23
+ },
15
24
  "dependencies": {
16
- "@typescript-eslint/eslint-plugin": "^8.24.1",
17
- "@typescript-eslint/parser": "^8.24.1",
18
- "eslint": "^9.20.1",
19
- "eslint-config-prettier": "^10.0.1",
25
+ "@eslint/js": "^9.22.0",
26
+ "eslint": "^9.22.0",
27
+ "eslint-config-prettier": "^10.1.1",
20
28
  "eslint-plugin-import": "^2.31.0",
21
- "eslint-plugin-jsdoc": "^50.6.3",
29
+ "eslint-plugin-jsdoc": "^50.6.6",
22
30
  "eslint-plugin-monorepo": "^0.3.2",
23
- "eslint-plugin-vue": "^9.32.0",
31
+ "eslint-plugin-vue": "^10.0.0",
24
32
  "eslint-plugin-workspaces": "^0.10.1",
25
- "tslib": "^2.8.1"
33
+ "globals": "^16.0.0",
34
+ "tslib": "^2.8.1",
35
+ "typescript-eslint": "^8.26.1",
36
+ "vue-eslint-parser": "^10.1.1"
26
37
  },
27
38
  "devDependencies": {
28
- "typescript": "^5.7.3"
39
+ "@nzyme/tsconfig": "0.8.0",
40
+ "jiti": "^2.4.2",
41
+ "typescript": "^5.8.2"
29
42
  }
30
43
  }
package/imports.js DELETED
@@ -1,27 +0,0 @@
1
- module.exports = {
2
- extends: ['plugin:import/errors', 'plugin:import/warnings', 'plugin:import/typescript'],
3
- plugins: ['eslint-plugin-import'],
4
- rules: {
5
- 'import/order': [
6
- 'warn',
7
- {
8
- 'newlines-between': 'always',
9
- groups: ['builtin', 'external', 'internal', ['parent', 'sibling'], 'index'],
10
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md#pathgroups-array-of-objects
11
- pathGroups: [
12
- {
13
- pattern: '@nzyme/**',
14
- group: 'internal',
15
- position: 'before',
16
- },
17
- ],
18
- pathGroupsExcludedImportTypes: ['builtin'],
19
- alphabetize: {
20
- order: 'asc',
21
- },
22
- },
23
- ],
24
- // we have TypeScript handling that
25
- 'import/no-unresolved': 'off',
26
- },
27
- };
package/jsdoc.js DELETED
@@ -1,30 +0,0 @@
1
- module.exports = {
2
- plugins: ['eslint-plugin-jsdoc'],
3
- extends: ['plugin:jsdoc/recommended-typescript'],
4
- rules: {
5
- 'jsdoc/require-jsdoc': [
6
- 1,
7
- {
8
- publicOnly: {
9
- esm: true,
10
- cjs: false,
11
- },
12
- contexts: [
13
- 'ClassDeclaration',
14
- 'ClassProperty',
15
- 'FunctionDeclaration',
16
- 'MethodDefinition',
17
- 'ExportNamedDeclaration > VariableDeclaration',
18
- 'TSDeclareFunction',
19
- 'TSEnumDeclaration',
20
- 'TSInterfaceDeclaration',
21
- 'TSMethodSignature',
22
- ':not(TSTypeParameterDeclaration) TSPropertySignature',
23
- 'TSTypeAliasDeclaration',
24
- ],
25
- },
26
- ],
27
- 'jsdoc/no-blank-block-descriptions': 'warn',
28
- 'jsdoc/no-blank-blocks': 'warn',
29
- },
30
- };
package/typescript.js DELETED
@@ -1,31 +0,0 @@
1
- module.exports = {
2
- env: {
3
- node: true,
4
- browser: true,
5
- },
6
- // Do not check eslint config files, because they collide with typecsript config.
7
- ignorePatterns: ['.eslintrc.cjs', 'dist/**/*', 'node_modules/**/*'],
8
- parser: '@typescript-eslint/parser',
9
- plugins: ['@typescript-eslint', 'workspaces', 'monorepo'],
10
- extends: [
11
- 'eslint:recommended',
12
- 'plugin:@typescript-eslint/eslint-recommended',
13
- 'plugin:@typescript-eslint/recommended',
14
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
15
- 'prettier',
16
- './imports',
17
- ],
18
- rules: {
19
- curly: 'error',
20
- 'require-await': 'error',
21
- '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
22
- '@typescript-eslint/consistent-type-imports': 'error',
23
- '@typescript-eslint/no-import-type-side-effects': 'error',
24
-
25
- 'workspaces/no-relative-imports': 'error',
26
- 'workspaces/no-absolute-imports': 'error',
27
- 'workspaces/require-dependency': 'error',
28
-
29
- 'monorepo/no-relative-import': 'error',
30
- },
31
- };
package/vue.js DELETED
@@ -1,20 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- node: true,
5
- },
6
- extends: ['plugin:vue/vue3-recommended', './typescript.js'],
7
- parser: 'vue-eslint-parser',
8
- parserOptions: {
9
- parser: '@typescript-eslint/parser',
10
- extraFileExtensions: ['.vue'],
11
- },
12
- plugins: [],
13
- rules: {
14
- 'vue/multi-word-component-names': 'off',
15
- // Not needed in vue 3
16
- 'vue/require-v-for-key': 'off',
17
- 'vue/require-default-prop': 'off',
18
- 'vue/one-component-per-file': 'off',
19
- },
20
- };