@kouts/eslint-config 1.3.0 → 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,77 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ branches: [main, beta]
6
+
7
+ jobs:
8
+ ci:
9
+ runs-on: ${{ matrix.os }}
10
+
11
+ strategy:
12
+ matrix:
13
+ os: [ubuntu-latest]
14
+ node: [20]
15
+
16
+ steps:
17
+ - name: Checkout 🛎
18
+ uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0
21
+
22
+ - name: Setup node env 🏗
23
+ uses: actions/setup-node@v4
24
+ with:
25
+ node-version: ${{ matrix.node }}
26
+ check-latest: true
27
+
28
+ - name: Setup pnpm 📦
29
+ uses: pnpm/action-setup@v4
30
+ with:
31
+ version: 9.7.1
32
+
33
+ - name: Install dependencies 📦
34
+ run: pnpm install
35
+
36
+ - name: Run linter 👀
37
+ run: pnpm run lint-fix
38
+
39
+ - name: Build ⚙️
40
+ run: pnpm run build
41
+ release:
42
+ runs-on: ${{ matrix.os }}
43
+ needs: ci
44
+
45
+ strategy:
46
+ matrix:
47
+ os: [ubuntu-latest]
48
+ node: [20]
49
+
50
+ steps:
51
+ - name: Checkout 🛎
52
+ uses: actions/checkout@v4
53
+ with:
54
+ fetch-depth: 0
55
+
56
+ - name: Setup node env 🏗
57
+ uses: actions/setup-node@v4
58
+ with:
59
+ node-version: ${{ matrix.node }}
60
+ check-latest: true
61
+
62
+ - name: Setup pnpm 📦
63
+ uses: pnpm/action-setup@v4
64
+ with:
65
+ version: 9.7.1
66
+
67
+ - name: Install dependencies 📦
68
+ run: pnpm install
69
+
70
+ - name: Install semantic-release extra plugins 📦
71
+ run: pnpm install --save-dev semantic-release @semantic-release/changelog @semantic-release/git
72
+
73
+ - name: Release
74
+ env:
75
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
77
+ run: npx semantic-release
@@ -0,0 +1 @@
1
+ npx --no-install commitlint --edit "$1"
@@ -0,0 +1 @@
1
+ npx lint-staged
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v20
package/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+ ## [1.3.2](https://github.com/kouts/eslint-config/compare/v1.3.1...v1.3.2) (2024-08-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * removed files from package.json ([881949b](https://github.com/kouts/eslint-config/commit/881949b7c353fc9ed0ed09106f91b450c28b78d1))
7
+
8
+ ## [1.3.1](https://github.com/kouts/eslint-config/compare/v1.3.0...v1.3.1) (2024-08-18)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * added build step ([1e9d478](https://github.com/kouts/eslint-config/commit/1e9d4786e58aa4265d21440628a4200abfed2883))
14
+
15
+ # [1.3.0](https://github.com/kouts/eslint-config/compare/v1.2.0...v1.3.0) (2024-08-17)
16
+
17
+
18
+ ### Features
19
+
20
+ * added vitest plugin ([b39e526](https://github.com/kouts/eslint-config/commit/b39e526a10b5e80d60b02e7f31293eb3d05f7bfa))
package/README_V0.md ADDED
@@ -0,0 +1,76 @@
1
+ # @kouts/eslint-config
2
+
3
+ > Custom ESLint and Prettier config with sensible defaults
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i -D @kouts/eslint-config eslint prettier
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ There are 4 ESLint config presets that you can use:
14
+
15
+ - `@kouts/eslint-config/javascript` for JavaScript / TypeScript projects
16
+ - `@kouts/eslint-config/vue2` for Vue.js 2 projects
17
+ - `@kouts/eslint-config/vue3` for Vue.js 3 projects
18
+ - `@kouts/eslint-config/vue3-typescript` for Vue.js 3 / TypeScript projects
19
+ - `@kouts/eslint-config/nuxt3` for Nuxt 3 projects
20
+
21
+ Add the desired config preset into your `.eslintrc.js` file:
22
+
23
+ ```javascript
24
+ module.exports = {
25
+ extends: ['@kouts/eslint-config/vue2']
26
+ }
27
+ ```
28
+
29
+ Add a `prettier.config.js` file with contents:
30
+
31
+ ```javascript
32
+ module.exports = require('@kouts/eslint-config/prettier.config.js')
33
+ ```
34
+
35
+ You can add ESLint commands to `.package-json`
36
+
37
+ ```json
38
+ {
39
+ "lint": "eslint \"**/*.{vue,ts,js}\"",
40
+ "lint-fix": "eslint --fix \"**/*.{vue,ts,js}\""
41
+ }
42
+ ```
43
+
44
+ and VS Code settings for autofix on save
45
+
46
+ `.vscode/settings.json`
47
+
48
+ ```json
49
+ {
50
+ "editor.formatOnSave": true,
51
+ "editor.codeActionsOnSave": {
52
+ "source.fixAll.eslint": true
53
+ },
54
+ "[javascript]": {
55
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
56
+ },
57
+ "[typescript]": {
58
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
59
+ }
60
+ }
61
+ ```
62
+
63
+ ## Features
64
+
65
+ - Based on [eslint-config-standard](https://github.com/standard/eslint-config-standard)
66
+ - [Prettier](https://prettier.io) for code formatting
67
+ - Plugins
68
+ - [eslint-plugin-html](https://github.com/BenoitZugmeyer/eslint-plugin-html) for linting inline scripts contained in HTML files
69
+ - [eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue/) for linting Vue.js files
70
+ - [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) for disabling all rules that conflict with Prettier
71
+ - [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) for using prettier as a code formatter for `eslint --fix`
72
+ - [sort-imports-es6-autofix](https://github.com/marudor/eslint-plugin-sort-imports-es6-autofix) for auto-fixing imports order
73
+
74
+ ## License
75
+
76
+ [MIT](http://opensource.org/licenses/MIT)
@@ -0,0 +1,6 @@
1
+ export default {
2
+ extends: ['@commitlint/config-conventional'],
3
+ rules: {
4
+ 'body-max-line-length': [1, 'always', 5000],
5
+ },
6
+ }
@@ -0,0 +1,8 @@
1
+ import { config } from './dist/index.js'
2
+
3
+ export default [
4
+ ...config(),
5
+ {
6
+ ignores: ['fixtures/**'],
7
+ },
8
+ ]
@@ -0,0 +1,3 @@
1
+ import { config } from './src'
2
+
3
+ export default config()
@@ -0,0 +1,2 @@
1
+ This is a fixture cloned from https://github.com/kouts/vue3-ts-vite-starter-template.
2
+ It uses the lint config from the parent directory to test linting.
@@ -0,0 +1,8 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module '*.vue' {
4
+ import { type DefineComponent } from 'vue'
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ const component: DefineComponent<object, object, any>
7
+ export default component
8
+ }
@@ -0,0 +1,12 @@
1
+ import { config } from '@kouts/eslint-config'
2
+
3
+ export default [
4
+ ...config(),
5
+ {
6
+ // Disable multi-word-component-names for pages and layouts
7
+ files: ['src/views/**/*.vue', 'src/layouts/**/*.vue'],
8
+ rules: {
9
+ 'vue/multi-word-component-names': 'off',
10
+ },
11
+ },
12
+ ]
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+ <meta name="description" content="<%= description %>">
8
+ <link rel="icon" href="/favicon.ico">
9
+ <link rel="preconnect" href="https://fonts.googleapis.com">
10
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">
12
+ <title>
13
+ <%= title %>
14
+ </title>
15
+ </head>
16
+
17
+ <body>
18
+ <noscript>
19
+ <strong>
20
+ we're sorry but <%= title %> doesn't work properly without JavaScript enabled. Please enable it to continue.
21
+ </strong>
22
+ </noscript>
23
+ <div id="app"></div>
24
+ <script type="module" src="/src/main.ts"></script>
25
+ </body>
26
+
27
+ </html>
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "vue3-ts-vite-starter-template",
3
+ "description": "Vue.js 3 TypeScript / Vite starter template with Pinia, Vue Router, Tailwind and more.",
4
+ "version": "0.0.0-semantic-release",
5
+ "license": "MIT",
6
+ "repository": "https://github.com/kouts/vue3-ts-vite-starter-template",
7
+ "packageManager": "pnpm@9.7.1",
8
+ "type": "module",
9
+ "scripts": {
10
+ "preinstall": "npx only-allow pnpm",
11
+ "dev": "vite",
12
+ "build": "vite build",
13
+ "preview": "vite preview",
14
+ "lint": "eslint \"**/*.{vue,ts,js}\"",
15
+ "lint-fix": "eslint --fix \"**/*.{vue,ts,js}\"",
16
+ "test:unit": "vitest",
17
+ "test:unit-coverage": "vitest run --coverage",
18
+ "typecheck": "vue-tsc --noEmit"
19
+ },
20
+ "dependencies": {
21
+ "pinia": "^2.2.2",
22
+ "vue": "^3.4.38",
23
+ "vue-router": "^4.4.3"
24
+ },
25
+ "devDependencies": {
26
+ "@fullhuman/postcss-purgecss": "^6.0.0",
27
+ "@fullhuman/vue-cli-plugin-purgecss": "^6.0.0",
28
+ "@kouts/eslint-config": "link:../..",
29
+ "@types/jsdom": "^21.1.7",
30
+ "@types/node": "^22.4.0",
31
+ "@vitejs/plugin-vue": "^5.1.2",
32
+ "@vitest/coverage-v8": "^2.0.5",
33
+ "@vue/compiler-sfc": "^3.4.38",
34
+ "@vue/test-utils": "^2.4.6",
35
+ "autoprefixer": "^10.4.20",
36
+ "eslint": "^9.9.0",
37
+ "jsdom": "^24.1.1",
38
+ "prettier": "^3.3.3",
39
+ "prettier-plugin-tailwindcss": "^0.6.6",
40
+ "sass": "^1.77.8",
41
+ "tailwindcss": "^3.4.10",
42
+ "typescript": "^5.5.4",
43
+ "vite": "^5.4.1",
44
+ "vitest": "^2.0.5",
45
+ "vue-tsc": "^2.0.29"
46
+ },
47
+ "resolutions": {
48
+ "@typescript-eslint/utils": "^8.1.0"
49
+ }
50
+ }