@kouts/eslint-config 1.3.1 → 1.3.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.
Files changed (49) hide show
  1. package/.github/workflows/release.yml +77 -0
  2. package/.husky/commit-msg +1 -0
  3. package/.husky/pre-commit +1 -0
  4. package/.nvmrc +1 -0
  5. package/CHANGELOG.md +20 -0
  6. package/README_V0.md +76 -0
  7. package/commitlint.config.js +6 -0
  8. package/eslint.config.js +8 -0
  9. package/eslint.config.ts +3 -0
  10. package/fixtures/vue3-ts-vite-starter-template/.nvmrc +1 -0
  11. package/fixtures/vue3-ts-vite-starter-template/README.md +2 -0
  12. package/fixtures/vue3-ts-vite-starter-template/env.d.ts +8 -0
  13. package/fixtures/vue3-ts-vite-starter-template/eslint.config.js +12 -0
  14. package/fixtures/vue3-ts-vite-starter-template/index.html +27 -0
  15. package/fixtures/vue3-ts-vite-starter-template/package.json +50 -0
  16. package/fixtures/vue3-ts-vite-starter-template/pnpm-lock.yaml +3253 -0
  17. package/fixtures/vue3-ts-vite-starter-template/postcss.config.js +28 -0
  18. package/fixtures/vue3-ts-vite-starter-template/prettier.config.js +3 -0
  19. package/fixtures/vue3-ts-vite-starter-template/public/favicon.ico +0 -0
  20. package/fixtures/vue3-ts-vite-starter-template/src/App.vue +14 -0
  21. package/fixtures/vue3-ts-vite-starter-template/src/assets/logo.svg +10 -0
  22. package/fixtures/vue3-ts-vite-starter-template/src/components/HelloWorld.vue +39 -0
  23. package/fixtures/vue3-ts-vite-starter-template/src/layouts/default/Default.vue +12 -0
  24. package/fixtures/vue3-ts-vite-starter-template/src/layouts/default/DefaultFooter.vue +10 -0
  25. package/fixtures/vue3-ts-vite-starter-template/src/layouts/default/DefaultNav.vue +74 -0
  26. package/fixtures/vue3-ts-vite-starter-template/src/main.ts +13 -0
  27. package/fixtures/vue3-ts-vite-starter-template/src/router/index.ts +32 -0
  28. package/fixtures/vue3-ts-vite-starter-template/src/scss/app.scss +4 -0
  29. package/fixtures/vue3-ts-vite-starter-template/src/scss/variables.scss +5 -0
  30. package/fixtures/vue3-ts-vite-starter-template/src/stores/counter.ts +16 -0
  31. package/fixtures/vue3-ts-vite-starter-template/src/views/About.vue +11 -0
  32. package/fixtures/vue3-ts-vite-starter-template/src/views/Home.vue +16 -0
  33. package/fixtures/vue3-ts-vite-starter-template/tailwind.config.js +12 -0
  34. package/fixtures/vue3-ts-vite-starter-template/tests/HelloWorld.spec.ts +10 -0
  35. package/fixtures/vue3-ts-vite-starter-template/tests/utils.ts +1 -0
  36. package/fixtures/vue3-ts-vite-starter-template/tests/vitest.global-setup.ts +3 -0
  37. package/fixtures/vue3-ts-vite-starter-template/tests/vitest.globals.ts +22 -0
  38. package/fixtures/vue3-ts-vite-starter-template/tsconfig.json +44 -0
  39. package/fixtures/vue3-ts-vite-starter-template/vite.config.ts +47 -0
  40. package/lint-staged.config.js +3 -0
  41. package/package.json +1 -4
  42. package/prettier.config.js +3 -0
  43. package/release.config.js +33 -0
  44. package/src/index.ts +153 -0
  45. package/src/prettier.ts +12 -0
  46. package/src/shims.d.ts +4 -0
  47. package/src/typescript.ts +37 -0
  48. package/src/vue.ts +83 -0
  49. package/tsconfig.json +17 -0
@@ -0,0 +1,12 @@
1
+ import { type Options } from 'prettier'
2
+
3
+ const configPrettier: Options = {
4
+ trailingComma: 'all',
5
+ printWidth: 128,
6
+ tabWidth: 2,
7
+ semi: false,
8
+ singleQuote: true,
9
+ arrowParens: 'always',
10
+ }
11
+
12
+ export default configPrettier
package/src/shims.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ declare module '@eslint/js'
2
+ declare module 'eslint-plugin-html'
3
+ declare module 'eslint-plugin-import-x'
4
+ declare module 'eslint-plugin-vue'
@@ -0,0 +1,37 @@
1
+ import type { Linter } from 'eslint'
2
+ import { plugins } from 'neostandard'
3
+
4
+ export const typescript: Linter.Config[] = [
5
+ ...(plugins['typescript-eslint'].configs.recommended as Linter.Config[]),
6
+ {
7
+ name: 'kouts/typescript',
8
+ rules: {
9
+ // Prefer T[] instead of Array<T>
10
+ '@typescript-eslint/array-type': ['error', { default: 'array' }],
11
+
12
+ // Prefer type over interface for objects
13
+ '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
14
+
15
+ // Fix type imports
16
+ '@typescript-eslint/consistent-type-imports': [
17
+ 'error',
18
+ {
19
+ prefer: 'type-imports',
20
+ fixStyle: 'inline-type-imports',
21
+ },
22
+ ],
23
+
24
+ // Allow _ for unused variables
25
+ '@typescript-eslint/no-unused-vars': [
26
+ 'error',
27
+ {
28
+ args: 'none',
29
+ caughtErrors: 'none',
30
+ ignoreRestSiblings: true,
31
+ vars: 'all',
32
+ argsIgnorePattern: '^_',
33
+ },
34
+ ],
35
+ },
36
+ },
37
+ ]
package/src/vue.ts ADDED
@@ -0,0 +1,83 @@
1
+ import type { Linter } from 'eslint'
2
+ import pluginVue from 'eslint-plugin-vue'
3
+ import { plugins } from 'neostandard'
4
+
5
+ type Options = {
6
+ version?: 2 | 3
7
+ ts?: boolean
8
+ }
9
+
10
+ const vue = (options?: Options) => {
11
+ const opts: Options = {
12
+ version: 3,
13
+ ts: true,
14
+ ...options,
15
+ }
16
+
17
+ const vueConfig = opts.version === 3 ? pluginVue.configs['flat/recommended'] : pluginVue.configs['flat/vue2-recommended']
18
+
19
+ const languageOptions = opts.ts
20
+ ? {
21
+ languageOptions: {
22
+ parserOptions: {
23
+ parser: plugins['typescript-eslint'].parser,
24
+ },
25
+ },
26
+ }
27
+ : {}
28
+
29
+ const config: Linter.Config[] = [
30
+ ...vueConfig,
31
+ {
32
+ name: 'kouts/vue',
33
+ files: ['*.vue', '**/*.vue'],
34
+ ...languageOptions,
35
+ rules: {
36
+ // Overrides for vue/(vue3-)recommended preset
37
+ 'vue/max-attributes-per-line': 'off',
38
+ 'vue/singleline-html-element-content-newline': 'off',
39
+
40
+ // Strengthen vue/(vue3-)recommended preset for autofix
41
+ // https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/configs/recommended.js
42
+ 'vue/attributes-order': 'error',
43
+ 'vue/component-tags-order': 'error',
44
+ 'vue/no-lone-template': 'error',
45
+ 'vue/no-multiple-slot-args': 'error',
46
+ 'vue/no-v-html': 'error',
47
+ 'vue/order-in-components': 'error',
48
+ 'vue/this-in-template': 'error',
49
+ 'vue/require-prop-types': 'error',
50
+
51
+ // Enforce PascalCase for Vue components
52
+ 'vue/component-name-in-template-casing': ['error', 'PascalCase', { registeredComponentsOnly: false, ignores: [] }],
53
+
54
+ // Do not allow inline styles
55
+ 'vue/no-static-inline-styles': ['error', { allowBinding: false }],
56
+
57
+ // Require explicit emits
58
+ 'vue/require-explicit-emits': 'error',
59
+
60
+ // Require component to have a name property
61
+ 'vue/require-name-property': 'error',
62
+
63
+ // Require components that don't have any content to self-close
64
+ 'vue/html-self-closing': [
65
+ 'error',
66
+ {
67
+ html: {
68
+ void: 'always',
69
+ normal: 'never',
70
+ component: 'always',
71
+ },
72
+ svg: 'always',
73
+ math: 'always',
74
+ },
75
+ ],
76
+ },
77
+ },
78
+ ]
79
+
80
+ return config
81
+ }
82
+
83
+ export { vue }
package/tsconfig.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "baseUrl": ".",
5
+ "module": "ESNext",
6
+ "moduleResolution": "Bundler",
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true
10
+ },
11
+ "include": [
12
+ "**/*.ts"
13
+ ],
14
+ "exclude": [
15
+ "./fixtures/**/*.*"
16
+ ]
17
+ }