eslint-plugin-vue-kuzzle 0.0.14 → 1.0.0-dev.2
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/README.md +68 -32
- package/dist/configs/base.js +26 -0
- package/dist/configs/base.js.map +1 -0
- package/dist/configs/default.js +10 -0
- package/dist/configs/default.js.map +1 -0
- package/dist/configs/typescript.js +47 -0
- package/dist/configs/typescript.js.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/importOptions.js +28 -0
- package/dist/utils/importOptions.js.map +1 -0
- package/package.json +24 -18
- package/lib/configs/base.js +0 -10
- package/lib/configs/default.js +0 -26
- package/lib/configs/typescript.js +0 -49
- package/lib/importOption.js +0 -27
- package/lib/index.js +0 -7
package/README.md
CHANGED
|
@@ -2,47 +2,83 @@
|
|
|
2
2
|
|
|
3
3
|
Kuzzle Coding Standard for Vue.js.
|
|
4
4
|
|
|
5
|
-
This plugin is standalone
|
|
5
|
+
This plugin is standalone: `eslint-plugin-vue`, `@vue/eslint-config-typescript`,
|
|
6
|
+
`@vue/eslint-config-prettier`, `typescript-eslint` and `eslint-plugin-import`
|
|
7
|
+
ship with it, so a consuming project only needs `eslint` itself.
|
|
6
8
|
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
1) Install the plugin
|
|
9
|
+
## Install
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm i eslint-plugin-vue-kuzzle
|
|
12
|
+
npm i -D eslint eslint-plugin-vue-kuzzle
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
The plugin is ESM and ships flat configs only. Create an `eslint.config.mjs` at
|
|
16
|
+
the root of your project:
|
|
16
17
|
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
"extends": [
|
|
20
|
-
"plugin:vue-kuzzle/defaultt",
|
|
21
|
-
"plugin:vue-kuzzle/base",
|
|
22
|
-
"plugin:vue-kuzzle/typescript"
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
```
|
|
18
|
+
```js
|
|
19
|
+
import vueKuzzle from 'eslint-plugin-vue-kuzzle';
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
export default [
|
|
22
|
+
{ ignores: ['dist/**', 'dist-ssr/**', 'coverage/**'] },
|
|
23
|
+
...vueKuzzle.configs.default,
|
|
24
|
+
];
|
|
25
|
+
```
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
`.eslintrc.json` and the `plugin:vue-kuzzle/*` syntax are gone: ESLint 9 removed
|
|
28
|
+
eslintrc support, and every config is now a plain array you spread.
|
|
30
29
|
|
|
31
30
|
## Available rule sets
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
- `vueKuzzle.configs.default`: the full standard — `base`, the Vue-aware
|
|
33
|
+
TypeScript parser setup from `@vue/eslint-config-typescript`, then
|
|
34
|
+
`typescript`. This is what you want unless you have a reason not to
|
|
35
|
+
- `vueKuzzle.configs.base`: Vue recommended rules, `import/order`, `no-console`,
|
|
36
|
+
`no-debugger`, then Prettier. No TypeScript
|
|
37
|
+
- `vueKuzzle.configs.typescript`: the Kuzzle TypeScript rules alone, applied to
|
|
38
|
+
`.ts`, `.tsx` and `.vue`. Composing this yourself means also providing a
|
|
39
|
+
parser that understands Vue SFCs
|
|
40
|
+
|
|
41
|
+
## Prettier
|
|
42
|
+
|
|
43
|
+
`@vue/eslint-config-prettier` runs Prettier as an eslint rule, so `eslint --fix`
|
|
44
|
+
reformats. Prettier reads your project's own configuration: without a
|
|
45
|
+
`.prettierrc`, it falls back to its defaults, which use double quotes. Add the
|
|
46
|
+
config your project actually wants.
|
|
47
|
+
|
|
48
|
+
## Overriding
|
|
49
|
+
|
|
50
|
+
`import/order` is opinionated about aliases, and assumes `~` and `@`. Turn it
|
|
51
|
+
off, or reconfigure it with the exported helper:
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
import vueKuzzle from 'eslint-plugin-vue-kuzzle';
|
|
55
|
+
import importOptions from 'eslint-plugin-vue-kuzzle/importOptions';
|
|
56
|
+
|
|
57
|
+
export default [
|
|
58
|
+
...vueKuzzle.configs.default,
|
|
59
|
+
{
|
|
60
|
+
rules: {
|
|
61
|
+
'import/order': ['error', importOptions(['@src', '@components'])],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
];
|
|
48
65
|
```
|
|
66
|
+
|
|
67
|
+
## Migrating from 1.0.0-eslint-9.x
|
|
68
|
+
|
|
69
|
+
Those prereleases never worked. The published tarball shipped `lib/*.ts` while
|
|
70
|
+
`main` pointed at `lib/index.js`, which the build emits to `dist/`, so the
|
|
71
|
+
package could not be resolved at all; and the configs inside were still
|
|
72
|
+
eslintrc-style (`extends: ["plugin:vue/recommended"]`, `overrides`,
|
|
73
|
+
`parserOptions.parser`), which ESLint 9 cannot read. Both are fixed here.
|
|
74
|
+
|
|
75
|
+
Beyond that:
|
|
76
|
+
|
|
77
|
+
- `@vue/eslint-config-standard` and `@vue/eslint-config-standard-with-typescript`
|
|
78
|
+
are dropped. Both are eslintrc-only, and StandardJS formatting conflicts with
|
|
79
|
+
Prettier, which the same config then had to undo
|
|
80
|
+
- the `eslint-plugin-jest` override is gone. No Kuzzle project uses Jest
|
|
81
|
+
- `eslint-plugin-vue` moves from 9 to 10, `@vue/eslint-config-typescript` from
|
|
82
|
+
14.1 to 14.9, `typescript-eslint` from 8.17 to 8.51
|
|
83
|
+
- the `./importOption` export is now `./importOptions`, which is the name of the
|
|
84
|
+
file it was always meant to point at
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import prettier from '@vue/eslint-config-prettier';
|
|
2
|
+
import importPlugin from 'eslint-plugin-import';
|
|
3
|
+
import pluginVue from 'eslint-plugin-vue';
|
|
4
|
+
import importOptions from '../utils/importOptions.js';
|
|
5
|
+
/**
|
|
6
|
+
* Rules shared by every Vue project, independently of TypeScript.
|
|
7
|
+
*
|
|
8
|
+
* `prettier` comes last so it wins over the formatting rules the Vue preset
|
|
9
|
+
* turns on.
|
|
10
|
+
*/
|
|
11
|
+
const baseConfig = [
|
|
12
|
+
...pluginVue.configs['flat/recommended'],
|
|
13
|
+
{
|
|
14
|
+
plugins: {
|
|
15
|
+
import: importPlugin,
|
|
16
|
+
},
|
|
17
|
+
rules: {
|
|
18
|
+
'import/order': ['error', importOptions(['~', '@'])],
|
|
19
|
+
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
20
|
+
'no-debugger': 'error',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
prettier,
|
|
24
|
+
];
|
|
25
|
+
export default baseConfig;
|
|
26
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../lib/configs/base.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,6BAA6B,CAAC;AACnD,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,aAAa,MAAM,2BAA2B,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,UAAU,GAAoC;IAClD,GAAG,SAAS,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACxC;QACE,OAAO,EAAE;YACP,MAAM,EAAE,YAAY;SACrB;QACD,KAAK,EAAE;YACL,cAAc,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACpD,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;YACrD,aAAa,EAAE,OAAO;SACvB;KACF;IACD,QAAQ;CACT,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript';
|
|
2
|
+
import baseConfig from './base.js';
|
|
3
|
+
import typescriptConfig from './typescript.js';
|
|
4
|
+
/**
|
|
5
|
+
* The full Kuzzle Vue standard: the shared rules, the Vue-aware TypeScript
|
|
6
|
+
* parser setup, then the TypeScript rules.
|
|
7
|
+
*/
|
|
8
|
+
const defaultConfig = defineConfigWithVueTs(...baseConfig, vueTsConfigs.recommended, ...typescriptConfig);
|
|
9
|
+
export default defaultConfig;
|
|
10
|
+
//# sourceMappingURL=default.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../lib/configs/default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,UAAU,MAAM,WAAW,CAAC;AACnC,OAAO,gBAAgB,MAAM,iBAAiB,CAAC;AAE/C;;;GAGG;AACH,MAAM,aAAa,GAAG,qBAAqB,CACzC,GAAG,UAAU,EACb,YAAY,CAAC,WAAW,EACxB,GAAG,gBAAgB,CACpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript rules, applied to Vue SFCs as well as plain `.ts` files.
|
|
3
|
+
*
|
|
4
|
+
* The parser is not set here: `@vue/eslint-config-typescript` already wires
|
|
5
|
+
* `vue-eslint-parser` with `@typescript-eslint/parser` for the script blocks,
|
|
6
|
+
* which is what `configs.default` composes below.
|
|
7
|
+
*/
|
|
8
|
+
const typescriptConfig = [
|
|
9
|
+
{
|
|
10
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.vue'],
|
|
11
|
+
rules: {
|
|
12
|
+
/**
|
|
13
|
+
* Force consistent type imports
|
|
14
|
+
*
|
|
15
|
+
* @see https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/
|
|
16
|
+
*/
|
|
17
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
18
|
+
'error',
|
|
19
|
+
{
|
|
20
|
+
disallowTypeAnnotations: true,
|
|
21
|
+
fixStyle: 'inline-type-imports',
|
|
22
|
+
prefer: 'type-imports',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
// Normalize method signature style
|
|
26
|
+
'@typescript-eslint/method-signature-style': 'error',
|
|
27
|
+
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
28
|
+
// Normalize eqeqeq rules in template like in script
|
|
29
|
+
'vue/eqeqeq': ['error', 'always'],
|
|
30
|
+
// Force self-closing to improve readability of templates
|
|
31
|
+
'vue/html-self-closing': [
|
|
32
|
+
'error',
|
|
33
|
+
{
|
|
34
|
+
html: {
|
|
35
|
+
component: 'always',
|
|
36
|
+
normal: 'always',
|
|
37
|
+
void: 'any',
|
|
38
|
+
},
|
|
39
|
+
math: 'always',
|
|
40
|
+
svg: 'always',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
export default typescriptConfig;
|
|
47
|
+
//# sourceMappingURL=typescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../lib/configs/typescript.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,gBAAgB,GAAoC;IACxD;QACE,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC;QAC1C,KAAK,EAAE;YACL;;;;eAIG;YACH,4CAA4C,EAAE;gBAC5C,OAAO;gBACP;oBACE,uBAAuB,EAAE,IAAI;oBAC7B,QAAQ,EAAE,qBAAqB;oBAC/B,MAAM,EAAE,cAAc;iBACvB;aACF;YACD,mCAAmC;YACnC,2CAA2C,EAAE,OAAO;YACpD,gDAAgD,EAAE,OAAO;YACzD,oDAAoD;YACpD,YAAY,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;YACjC,yDAAyD;YACzD,uBAAuB,EAAE;gBACvB,OAAO;gBACP;oBACE,IAAI,EAAE;wBACJ,SAAS,EAAE,QAAQ;wBACnB,MAAM,EAAE,QAAQ;wBAChB,IAAI,EAAE,KAAK;qBACZ;oBACD,IAAI,EAAE,QAAQ;oBACd,GAAG,EAAE,QAAQ;iBACd;aACF;SACF;KACF;CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import baseConfig from './configs/base.js';
|
|
5
|
+
import defaultConfig from './configs/default.js';
|
|
6
|
+
import typescriptConfig from './configs/typescript.js';
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
const pj = resolve(__dirname, '..', 'package.json');
|
|
10
|
+
const pkg = JSON.parse(readFileSync(pj, 'utf8'));
|
|
11
|
+
const plugin = {
|
|
12
|
+
configs: {
|
|
13
|
+
base: baseConfig,
|
|
14
|
+
default: defaultConfig,
|
|
15
|
+
typescript: typescriptConfig,
|
|
16
|
+
},
|
|
17
|
+
meta: {
|
|
18
|
+
name: pkg.name,
|
|
19
|
+
version: pkg.version,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export default plugin;
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AAEvD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;AACpD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;AAEjD,MAAM,MAAM,GAA+B;IACzC,OAAO,EAAE;QACP,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,aAAa;QACtB,UAAU,EAAE,gBAAgB;KAC7B;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,OAAO,EAAE,GAAG,CAAC,OAAO;KACrB;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../lib/index.ts","../lib/configs/base.ts","../lib/configs/default.ts","../lib/configs/typescript.ts","../lib/utils/importOptions.ts"],"version":"5.9.3"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// ? Eslint plugin rules are not applicable for this function, because it's not a code of eslint rule
|
|
2
|
+
/* eslint-disable eslint-plugin/prefer-message-ids, eslint-plugin/prefer-object-rule, eslint-plugin/require-meta-type, eslint-plugin/require-meta-schema */
|
|
3
|
+
const importOptions = (alias) => {
|
|
4
|
+
const aliases = Array.isArray(alias) ? alias : [alias];
|
|
5
|
+
return {
|
|
6
|
+
groups: ['builtin', 'external', 'parent', 'sibling'],
|
|
7
|
+
pathGroups: [
|
|
8
|
+
{ pattern: 'vue', group: 'external', position: 'before' },
|
|
9
|
+
// ? Patterns should be sorting of more precise to more generic
|
|
10
|
+
...aliases.map((alias) => ({ pattern: `${alias}/**/*.vue`, group: 'sibling' })),
|
|
11
|
+
{ pattern: './**/*.vue', group: 'sibling', position: 'after' },
|
|
12
|
+
...aliases.map((alias) => ({ pattern: `${alias}/**/*`, group: 'parent' })),
|
|
13
|
+
{ pattern: './**/*', group: 'parent', position: 'after' },
|
|
14
|
+
],
|
|
15
|
+
/**
|
|
16
|
+
* ? Particular case: need to exclude `vue` of external import group to can be sorted with pattern
|
|
17
|
+
* @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md#pathgroupsexcludedimporttypes-array
|
|
18
|
+
*/
|
|
19
|
+
pathGroupsExcludedImportTypes: ['vue'],
|
|
20
|
+
'newlines-between': 'always',
|
|
21
|
+
distinctGroup: false,
|
|
22
|
+
alphabetize: {
|
|
23
|
+
order: 'asc',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default importOptions;
|
|
28
|
+
//# sourceMappingURL=importOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importOptions.js","sourceRoot":"","sources":["../../lib/utils/importOptions.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,2JAA2J;AAC3J,MAAM,aAAa,GAAG,CAAC,KAAwB,EAAE,EAAE;IACjD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAEvD,OAAO;QACL,MAAM,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC;QACpD,UAAU,EAAE;YACV,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE;YACzD,+DAA+D;YAC/D,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YAC/E,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE;YAC9D,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC1E,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE;SAC1D;QACD;;;WAGG;QACH,6BAA6B,EAAE,CAAC,KAAK,CAAC;QACtC,kBAAkB,EAAE,QAAQ;QAC5B,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE;YACX,KAAK,EAAE,KAAK;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-vue-kuzzle",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "1.0.0-dev.2",
|
|
4
4
|
"description": "Kuzzle Vue Coding Standard",
|
|
5
5
|
"homepage": "https://github.com/kuzzleio/eslint-plugin-kuzzle",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/kuzzleio/eslint-plugin-kuzzle.git",
|
|
8
|
+
"url": "git+https://github.com/kuzzleio/eslint-plugin-kuzzle.git",
|
|
9
9
|
"directory": "packages/frontend"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [
|
|
@@ -15,14 +15,16 @@
|
|
|
15
15
|
"kuzzle"
|
|
16
16
|
],
|
|
17
17
|
"author": "The Kuzzle Team",
|
|
18
|
-
"
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "dist/index.js",
|
|
19
20
|
"scripts": {
|
|
20
|
-
"lint": "eslint
|
|
21
|
+
"lint": "eslint",
|
|
22
|
+
"clean": "rimraf dist",
|
|
23
|
+
"build": "npm run clean && tsc --build"
|
|
21
24
|
},
|
|
22
25
|
"peerDependencies": {
|
|
23
|
-
"eslint": "
|
|
24
|
-
"
|
|
25
|
-
"typescript": ">= 5.2 <5.5"
|
|
26
|
+
"eslint": "^9.10.0 || ^10.0.0",
|
|
27
|
+
"typescript": ">= 5.2.0 <6.0.0"
|
|
26
28
|
},
|
|
27
29
|
"peerDependenciesMeta": {
|
|
28
30
|
"typescript": {
|
|
@@ -30,26 +32,30 @@
|
|
|
30
32
|
}
|
|
31
33
|
},
|
|
32
34
|
"dependencies": {
|
|
33
|
-
"@vue/eslint-config-prettier": "
|
|
34
|
-
"@vue/eslint-config-
|
|
35
|
-
"
|
|
36
|
-
"eslint-plugin-
|
|
35
|
+
"@vue/eslint-config-prettier": "^10.2.0",
|
|
36
|
+
"@vue/eslint-config-typescript": "^14.9.0",
|
|
37
|
+
"eslint-plugin-import": "^2.32.0",
|
|
38
|
+
"eslint-plugin-vue": "^10.11.0",
|
|
39
|
+
"globals": "^16.5.0",
|
|
40
|
+
"typescript-eslint": "^8.51.0"
|
|
37
41
|
},
|
|
38
42
|
"devDependencies": {
|
|
39
|
-
"
|
|
40
|
-
"typescript": "
|
|
43
|
+
"@types/node": "^22.20.1",
|
|
44
|
+
"@typescript-eslint/utils": "^8.51.0",
|
|
45
|
+
"rimraf": "^6.0.1",
|
|
46
|
+
"typescript": "~5.9.0"
|
|
41
47
|
},
|
|
42
|
-
"license": "Apache
|
|
48
|
+
"license": "Apache-2.0",
|
|
43
49
|
"files": [
|
|
44
|
-
"
|
|
50
|
+
"dist/",
|
|
45
51
|
"README.md",
|
|
46
52
|
"package.json"
|
|
47
53
|
],
|
|
48
54
|
"exports": {
|
|
49
|
-
".": "./
|
|
50
|
-
"./
|
|
55
|
+
".": "./dist/index.js",
|
|
56
|
+
"./importOptions": "./dist/utils/importOptions.js"
|
|
51
57
|
},
|
|
52
58
|
"engines": {
|
|
53
|
-
"node": "
|
|
59
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
54
60
|
}
|
|
55
61
|
}
|
package/lib/configs/base.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const importOptions = require('../importOption');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
extends: ['plugin:vue/recommended', '@vue/standard', '@vue/prettier'],
|
|
5
|
-
rules: {
|
|
6
|
-
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
7
|
-
'no-debugger': 'error',
|
|
8
|
-
'import/order': ['error', importOptions(['~', '@'])],
|
|
9
|
-
},
|
|
10
|
-
};
|
package/lib/configs/default.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const baseConfig = require('./base');
|
|
2
|
-
const typescriptConfig = require('./typescript');
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
...baseConfig,
|
|
6
|
-
overrides: [
|
|
7
|
-
{
|
|
8
|
-
files: ['vite.config.ts'],
|
|
9
|
-
parserOptions: {
|
|
10
|
-
parser: '@typescript-eslint/parser',
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
files: ['tests/**/*.ts'],
|
|
15
|
-
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
|
|
16
|
-
parserOptions: {
|
|
17
|
-
parser: '@typescript-eslint/parser',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
// Apply vue and typescript rules only on Vue SFC and typescript files
|
|
22
|
-
files: ['src/**/*.{vue,ts}'],
|
|
23
|
-
...typescriptConfig,
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: 'vue-eslint-parser',
|
|
3
|
-
parserOptions: {
|
|
4
|
-
// ? Optimize Vue parsing (see: https://github.com/vuejs/vue-eslint-parser/issues/104)
|
|
5
|
-
parser: {
|
|
6
|
-
ts: '@typescript-eslint/parser',
|
|
7
|
-
js: '@typescript-eslint/parser',
|
|
8
|
-
'<template>': 'espree',
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
extends: [
|
|
12
|
-
'@vue/typescript/recommended',
|
|
13
|
-
// Need to repeat prettier here to keep rules priority over previous rulesset
|
|
14
|
-
'@vue/prettier',
|
|
15
|
-
],
|
|
16
|
-
rules: {
|
|
17
|
-
// Normalize eqeqeq rules in template like in script
|
|
18
|
-
'vue/eqeqeq': ['error', 'always'],
|
|
19
|
-
// Force self-closing to improve readability of templates
|
|
20
|
-
'vue/html-self-closing': [
|
|
21
|
-
'error',
|
|
22
|
-
{
|
|
23
|
-
html: {
|
|
24
|
-
void: 'any',
|
|
25
|
-
normal: 'always',
|
|
26
|
-
component: 'always',
|
|
27
|
-
},
|
|
28
|
-
svg: 'always',
|
|
29
|
-
math: 'always',
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
/**
|
|
33
|
-
* Force consistent type imports
|
|
34
|
-
*
|
|
35
|
-
* @see https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/
|
|
36
|
-
*/
|
|
37
|
-
'@typescript-eslint/consistent-type-imports': [
|
|
38
|
-
'error',
|
|
39
|
-
{
|
|
40
|
-
disallowTypeAnnotations: true,
|
|
41
|
-
fixStyle: 'inline-type-imports',
|
|
42
|
-
prefer: 'type-imports',
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
46
|
-
// Normalize methode signature style
|
|
47
|
-
'@typescript-eslint/method-signature-style': 'error',
|
|
48
|
-
},
|
|
49
|
-
};
|
package/lib/importOption.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// ? Eslint plugin rules are not applicable for this function, because it's not a code of eslint rule
|
|
2
|
-
/* eslint-disable eslint-plugin/prefer-message-ids, eslint-plugin/prefer-object-rule, eslint-plugin/require-meta-type, eslint-plugin/require-meta-schema */
|
|
3
|
-
module.exports = (alias) => {
|
|
4
|
-
const aliases = Array.isArray(alias) ? alias : [alias];
|
|
5
|
-
|
|
6
|
-
return {
|
|
7
|
-
groups: ['builtin', 'external', 'parent', 'sibling'],
|
|
8
|
-
pathGroups: [
|
|
9
|
-
{ pattern: 'vue', group: 'external', position: 'before' },
|
|
10
|
-
// ? Patterns should be sorting of more precise to more generic
|
|
11
|
-
...aliases.map((alias) => ({ pattern: `${alias}/**/*.vue`, group: 'sibling' })),
|
|
12
|
-
{ pattern: './**/*.vue', group: 'sibling', position: 'after' },
|
|
13
|
-
...aliases.map((alias) => ({ pattern: `${alias}/**/*`, group: 'parent' })),
|
|
14
|
-
{ pattern: './**/*', group: 'parent', position: 'after' },
|
|
15
|
-
],
|
|
16
|
-
/**
|
|
17
|
-
* ? Particular case: need to exclude `vue` of external import group to can be sorted with pattern
|
|
18
|
-
* @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md#pathgroupsexcludedimporttypes-array
|
|
19
|
-
*/
|
|
20
|
-
pathGroupsExcludedImportTypes: ['vue'],
|
|
21
|
-
'newlines-between': 'always',
|
|
22
|
-
distinctGroup: false,
|
|
23
|
-
alphabetize: {
|
|
24
|
-
order: 'asc',
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
};
|