@nzyme/eslint 0.7.0 → 0.9.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,9 @@
1
+ export interface ImportGroup {
2
+ pattern: string;
3
+ group: 'builtin' | 'external' | 'internal' | 'parent' | 'sibling' | 'index';
4
+ position?: 'before' | 'after';
5
+ }
6
+ export interface ImportsOptions {
7
+ groups?: ImportGroup[];
8
+ }
9
+ export declare function imports(options?: ImportsOptions): import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
@@ -0,0 +1,41 @@
1
+ import tseslint from 'typescript-eslint';
2
+ import importsPlugin from 'eslint-plugin-import';
3
+ export function imports(options = {}) {
4
+ return tseslint.config({
5
+ extends: [importsPlugin.flatConfigs.recommended, importsPlugin.flatConfigs.typescript],
6
+ ignores: ['dist/**/*', 'node_modules/**/*'],
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
+ //# sourceMappingURL=imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/imports.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAYjD,MAAM,UAAU,OAAO,CAAC,UAA0B,EAAE;IAChD,OAAO,QAAQ,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,WAAW,EAAE,aAAa,CAAC,WAAW,CAAC,UAAU,CAAC;QACtF,OAAO,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;QAC3C,KAAK,EAAE;YACH,cAAc,EAAE;gBACZ,MAAM;gBACN;oBACI,UAAU,EAAE,KAAK;oBACjB,qBAAqB,EAAE,IAAI;oBAC3B,gBAAgB,EAAE,KAAK;oBACvB,oBAAoB,EAAE,IAAI;iBAC7B;aACJ;YACD,cAAc,EAAE;gBACZ,MAAM;gBACN;oBACI,kBAAkB,EAAE,QAAQ;oBAC5B,MAAM,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC;oBAC3E,gHAAgH;oBAChH,UAAU,EAAE,OAAO,CAAC,MAAM,IAAI;wBAC1B;4BACI,OAAO,EAAE,WAAW;4BACpB,KAAK,EAAE,UAAU;4BACjB,QAAQ,EAAE,QAAQ;yBACrB;qBACJ;oBACD,6BAA6B,EAAE,CAAC,SAAS,CAAC;oBAC1C,WAAW,EAAE;wBACT,KAAK,EAAE,KAAK;qBACf;iBACJ;aACJ;YACD,mCAAmC;YACnC,sBAAsB,EAAE,KAAK;SAChC;KACJ,CAAC,CAAC;AACP,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,6 @@
1
+ export type Target = 'node' | 'browser';
2
+ export interface TypescriptOptions {
3
+ target?: Target[] | Target;
4
+ project?: string | string[];
5
+ }
6
+ export declare function typescript(options: TypescriptOptions): import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
@@ -0,0 +1,67 @@
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/**/*', 'eslint.config.js'],
10
+ files: ['**/*.{ts,tsx}'],
11
+ plugins: {
12
+ workspaces,
13
+ monorepo,
14
+ },
15
+ languageOptions: {
16
+ parserOptions: {
17
+ project: options.project || './tsconfig.json',
18
+ },
19
+ },
20
+ rules: {
21
+ curly: 'error',
22
+ 'require-await': 'error',
23
+ '@typescript-eslint/no-unused-vars': [
24
+ 'error',
25
+ {
26
+ args: 'all',
27
+ argsIgnorePattern: '^_',
28
+ caughtErrors: 'all',
29
+ caughtErrorsIgnorePattern: '^_',
30
+ destructuredArrayIgnorePattern: '^_',
31
+ varsIgnorePattern: '^_',
32
+ },
33
+ ],
34
+ '@typescript-eslint/consistent-type-imports': 'error',
35
+ '@typescript-eslint/no-import-type-side-effects': 'error',
36
+ 'workspaces/no-relative-imports': 'error',
37
+ 'workspaces/no-absolute-imports': 'error',
38
+ 'workspaces/require-dependency': 'error',
39
+ 'monorepo/no-relative-import': 'error',
40
+ },
41
+ };
42
+ if (Array.isArray(options.target)) {
43
+ config.languageOptions = {
44
+ ...config.languageOptions,
45
+ globals: options.target.reduce((acc, target) => ({ ...acc, ...getTargetGlobals(target) }), {}),
46
+ };
47
+ }
48
+ else if (options.target) {
49
+ config.languageOptions = {
50
+ ...config.languageOptions,
51
+ globals: getTargetGlobals(options.target),
52
+ };
53
+ }
54
+ return tseslint.config({
55
+ extends: [js.configs.recommended, ...tseslint.configs.recommendedTypeChecked, prettier],
56
+ ...config,
57
+ });
58
+ }
59
+ function getTargetGlobals(target) {
60
+ switch (target) {
61
+ case 'node':
62
+ return globals.node;
63
+ case 'browser':
64
+ return globals.browser;
65
+ }
66
+ }
67
+ //# 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;AAU9C,MAAM,UAAU,UAAU,CAAC,OAA0B;IACjD,MAAM,MAAM,GAAkB;QAC1B,OAAO,EAAE,CAAC,WAAW,EAAE,mBAAmB,EAAE,kBAAkB,CAAC;QAC/D,KAAK,EAAE,CAAC,eAAe,CAAC;QACxB,OAAO,EAAE;YACL,UAAU;YACV,QAAQ;SACX;QACD,eAAe,EAAE;YACb,aAAa,EAAE;gBACX,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,iBAAiB;aAChD;SACJ;QACD,KAAK,EAAE;YACH,KAAK,EAAE,OAAO;YACd,eAAe,EAAE,OAAO;YACxB,mCAAmC,EAAE;gBACjC,OAAO;gBACP;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AC,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,6 +1,6 @@
1
1
  {
2
2
  "name": "@nzyme/eslint",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,20 +10,34 @@
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
+ "type": "module",
13
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
+ },
14
24
  "dependencies": {
15
- "@typescript-eslint/eslint-plugin": "^8.25.0",
16
- "@typescript-eslint/parser": "^8.25.0",
17
- "eslint": "^9.21.0",
18
- "eslint-config-prettier": "^10.0.1",
25
+ "@eslint/js": "^9.23.0",
26
+ "eslint": "^9.23.0",
27
+ "eslint-config-prettier": "^10.1.1",
19
28
  "eslint-plugin-import": "^2.31.0",
20
- "eslint-plugin-jsdoc": "^50.6.3",
29
+ "eslint-plugin-jsdoc": "^50.6.9",
21
30
  "eslint-plugin-monorepo": "^0.3.2",
22
- "eslint-plugin-vue": "^9.32.0",
31
+ "eslint-plugin-vue": "^10.0.0",
23
32
  "eslint-plugin-workspaces": "^0.10.1",
24
- "tslib": "^2.8.1"
33
+ "globals": "^16.0.0",
34
+ "tslib": "^2.8.1",
35
+ "typescript-eslint": "^8.28.0",
36
+ "vue-eslint-parser": "^10.1.1"
25
37
  },
26
38
  "devDependencies": {
27
- "typescript": "^5.7.3"
39
+ "@nzyme/tsconfig": "0.9.0",
40
+ "jiti": "^2.4.2",
41
+ "typescript": "^5.8.2"
28
42
  }
29
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
- };