@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.
- package/.github/workflows/release.yml +77 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +1 -0
- package/.nvmrc +1 -0
- package/CHANGELOG.md +20 -0
- package/README_V0.md +76 -0
- package/commitlint.config.js +6 -0
- package/eslint.config.js +8 -0
- package/eslint.config.ts +3 -0
- package/fixtures/vue3-ts-vite-starter-template/.nvmrc +1 -0
- package/fixtures/vue3-ts-vite-starter-template/README.md +2 -0
- package/fixtures/vue3-ts-vite-starter-template/env.d.ts +8 -0
- package/fixtures/vue3-ts-vite-starter-template/eslint.config.js +12 -0
- package/fixtures/vue3-ts-vite-starter-template/index.html +27 -0
- package/fixtures/vue3-ts-vite-starter-template/package.json +50 -0
- package/fixtures/vue3-ts-vite-starter-template/pnpm-lock.yaml +3253 -0
- package/fixtures/vue3-ts-vite-starter-template/postcss.config.js +28 -0
- package/fixtures/vue3-ts-vite-starter-template/prettier.config.js +3 -0
- package/fixtures/vue3-ts-vite-starter-template/public/favicon.ico +0 -0
- package/fixtures/vue3-ts-vite-starter-template/src/App.vue +14 -0
- package/fixtures/vue3-ts-vite-starter-template/src/assets/logo.svg +10 -0
- package/fixtures/vue3-ts-vite-starter-template/src/components/HelloWorld.vue +39 -0
- package/fixtures/vue3-ts-vite-starter-template/src/layouts/default/Default.vue +12 -0
- package/fixtures/vue3-ts-vite-starter-template/src/layouts/default/DefaultFooter.vue +10 -0
- package/fixtures/vue3-ts-vite-starter-template/src/layouts/default/DefaultNav.vue +74 -0
- package/fixtures/vue3-ts-vite-starter-template/src/main.ts +13 -0
- package/fixtures/vue3-ts-vite-starter-template/src/router/index.ts +32 -0
- package/fixtures/vue3-ts-vite-starter-template/src/scss/app.scss +4 -0
- package/fixtures/vue3-ts-vite-starter-template/src/scss/variables.scss +5 -0
- package/fixtures/vue3-ts-vite-starter-template/src/stores/counter.ts +16 -0
- package/fixtures/vue3-ts-vite-starter-template/src/views/About.vue +11 -0
- package/fixtures/vue3-ts-vite-starter-template/src/views/Home.vue +16 -0
- package/fixtures/vue3-ts-vite-starter-template/tailwind.config.js +12 -0
- package/fixtures/vue3-ts-vite-starter-template/tests/HelloWorld.spec.ts +10 -0
- package/fixtures/vue3-ts-vite-starter-template/tests/utils.ts +1 -0
- package/fixtures/vue3-ts-vite-starter-template/tests/vitest.global-setup.ts +3 -0
- package/fixtures/vue3-ts-vite-starter-template/tests/vitest.globals.ts +22 -0
- package/fixtures/vue3-ts-vite-starter-template/tsconfig.json +44 -0
- package/fixtures/vue3-ts-vite-starter-template/vite.config.ts +47 -0
- package/lint-staged.config.js +3 -0
- package/package.json +1 -4
- package/prettier.config.js +3 -0
- package/release.config.js +33 -0
- package/src/index.ts +153 -0
- package/src/prettier.ts +12 -0
- package/src/shims.d.ts +4 -0
- package/src/typescript.ts +37 -0
- package/src/vue.ts +83 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import postcssPurgecss from '@fullhuman/postcss-purgecss'
|
|
2
|
+
import autoprefixer from 'autoprefixer'
|
|
3
|
+
import tailwindcss from 'tailwindcss'
|
|
4
|
+
|
|
5
|
+
const IN_PRODUCTION = process.env.NODE_ENV === 'production'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
plugins: [
|
|
9
|
+
tailwindcss,
|
|
10
|
+
autoprefixer,
|
|
11
|
+
IN_PRODUCTION &&
|
|
12
|
+
postcssPurgecss({
|
|
13
|
+
content: ['./**/*.html', './src/**/*.vue'],
|
|
14
|
+
defaultExtractor(content) {
|
|
15
|
+
const contentWithoutStyleBlocks = content.replace(/<style[^]+?<\/style>/gi, '')
|
|
16
|
+
|
|
17
|
+
return contentWithoutStyleBlocks.match(/[A-Za-z0-9-_/:]*[A-Za-z0-9-_/]+/g) || []
|
|
18
|
+
},
|
|
19
|
+
safelist: [
|
|
20
|
+
/-(leave|enter|appear)(|-(to|from|active))$/,
|
|
21
|
+
/^(?!(|.*?:)cursor-move).+-move$/,
|
|
22
|
+
/^router-link(|-exact)-active$/,
|
|
23
|
+
/data-v-.*/,
|
|
24
|
+
/^active/,
|
|
25
|
+
],
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
28
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="layout">
|
|
3
|
+
<RouterView />
|
|
4
|
+
</component>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import '@/scss/app.scss'
|
|
9
|
+
import { computed } from 'vue'
|
|
10
|
+
import { useRoute } from 'vue-router'
|
|
11
|
+
|
|
12
|
+
const route = useRoute()
|
|
13
|
+
const layout = computed(() => `layout-${route.meta.layout || 'default'}`)
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg version="1.1" viewBox="0 0 261.76 226.69" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g transform="matrix(1.3333 0 0 -1.3333 -76.311 313.34)">
|
|
3
|
+
<g transform="translate(178.06 235.01)">
|
|
4
|
+
<path d="m0 0-22.669-39.264-22.669 39.264h-75.491l98.16-170.02 98.16 170.02z" fill="#41b883" />
|
|
5
|
+
</g>
|
|
6
|
+
<g transform="translate(178.06 235.01)">
|
|
7
|
+
<path d="m0 0-22.669-39.264-22.669 39.264h-36.227l58.896-102.01 58.896 102.01z" fill="#34495e" />
|
|
8
|
+
</g>
|
|
9
|
+
</g>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex-col text-center">
|
|
3
|
+
<h1 class="msg text-4xl font-medium">{{ msg }}</h1>
|
|
4
|
+
<p class="mt-4">
|
|
5
|
+
A project setup using Vite, created to easily scaffold new Vue.js 3 projects.
|
|
6
|
+
<br />
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p>
|
|
10
|
+
Find out more at<a
|
|
11
|
+
class="text-emerald-500 hover:text-emerald-600"
|
|
12
|
+
href="https://vitejs.dev/guide/"
|
|
13
|
+
target="_blank"
|
|
14
|
+
rel="noopener"
|
|
15
|
+
>
|
|
16
|
+
Vite documentation</a
|
|
17
|
+
>.
|
|
18
|
+
</p>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
defineOptions({
|
|
24
|
+
name: 'HelloWorld',
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
defineProps({
|
|
28
|
+
msg: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: '',
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<style lang="scss" scoped>
|
|
36
|
+
h1.msg {
|
|
37
|
+
color: $slate-700;
|
|
38
|
+
}
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="min-h-screen pt-24 text-slate-700">
|
|
3
|
+
<DefaultNav />
|
|
4
|
+
<slot />
|
|
5
|
+
<DefaultFooter />
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import DefaultFooter from './DefaultFooter.vue'
|
|
11
|
+
import DefaultNav from './DefaultNav.vue'
|
|
12
|
+
</script>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<footer class="sticky top-[100vh] flex h-16 items-center justify-center bg-neutral-100">
|
|
3
|
+
<div>
|
|
4
|
+
<span>Developed by</span>
|
|
5
|
+
<a href="https://github.com/kouts" target="_blank" rel="noopener" class="text-emerald-500 hover:text-emerald-600">
|
|
6
|
+
@kouts
|
|
7
|
+
</a>
|
|
8
|
+
</div>
|
|
9
|
+
</footer>
|
|
10
|
+
</template>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nav class="fixed start-0 top-0 z-20 w-full border-b border-slate-200 bg-white">
|
|
3
|
+
<div class="mx-auto flex max-w-screen-xl flex-wrap items-center justify-between px-4 py-3 md:justify-normal md:py-4">
|
|
4
|
+
<RouterLink to="/" class="flex items-center space-x-3 no-underline rtl:space-x-reverse">
|
|
5
|
+
<span class="self-center whitespace-nowrap text-2xl font-semibold text-slate-600">ProjectName</span>
|
|
6
|
+
</RouterLink>
|
|
7
|
+
<div class="flex space-x-3 md:space-x-0 rtl:space-x-reverse">
|
|
8
|
+
<button
|
|
9
|
+
data-collapse-toggle="navbar-sticky"
|
|
10
|
+
type="button"
|
|
11
|
+
class="inline-flex h-10 w-10 items-center justify-center rounded-lg p-2 text-sm hover:bg-slate-100 focus:outline-none focus:ring-2 focus:ring-slate-200 md:hidden"
|
|
12
|
+
aria-controls="navbar-sticky"
|
|
13
|
+
:aria-expanded="navbarExpanded"
|
|
14
|
+
@click="toggleNavbar"
|
|
15
|
+
>
|
|
16
|
+
<span class="sr-only">Open main menu</span>
|
|
17
|
+
<svg class="h-5 w-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 14">
|
|
18
|
+
<path
|
|
19
|
+
stroke="currentColor"
|
|
20
|
+
stroke-linecap="round"
|
|
21
|
+
stroke-linejoin="round"
|
|
22
|
+
stroke-width="2"
|
|
23
|
+
d="M1 1h15M1 7h15M1 13h15"
|
|
24
|
+
/>
|
|
25
|
+
</svg>
|
|
26
|
+
</button>
|
|
27
|
+
</div>
|
|
28
|
+
<div
|
|
29
|
+
id="navbar-sticky"
|
|
30
|
+
:class="['w-full items-center justify-between md:order-1 md:ml-8 md:flex md:w-auto', { hidden: !navbarExpanded }]"
|
|
31
|
+
>
|
|
32
|
+
<ul
|
|
33
|
+
class="mt-4 flex flex-col rounded-lg border border-slate-100 bg-slate-50 p-4 font-medium md:mt-0 md:flex-row md:space-x-8 md:border-0 md:bg-white md:p-0 rtl:space-x-reverse dark:border-slate-700 dark:bg-slate-800 md:dark:bg-slate-900"
|
|
34
|
+
>
|
|
35
|
+
<li>
|
|
36
|
+
<RouterLink
|
|
37
|
+
to="/"
|
|
38
|
+
class="block rounded px-3 py-2 no-underline hover:text-emerald-600 md:bg-transparent md:p-0 md:hover:text-emerald-600"
|
|
39
|
+
:active-class="activeClass"
|
|
40
|
+
@click="closeNavBar"
|
|
41
|
+
>
|
|
42
|
+
Home
|
|
43
|
+
</RouterLink>
|
|
44
|
+
</li>
|
|
45
|
+
<li>
|
|
46
|
+
<RouterLink
|
|
47
|
+
to="/about"
|
|
48
|
+
class="block rounded px-3 py-2 no-underline hover:text-emerald-600 md:bg-transparent md:p-0 md:hover:text-emerald-600"
|
|
49
|
+
:active-class="activeClass"
|
|
50
|
+
@click="closeNavBar"
|
|
51
|
+
>
|
|
52
|
+
About
|
|
53
|
+
</RouterLink>
|
|
54
|
+
</li>
|
|
55
|
+
</ul>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</nav>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script setup lang="ts">
|
|
62
|
+
import { ref } from 'vue'
|
|
63
|
+
|
|
64
|
+
const navbarExpanded = ref(false)
|
|
65
|
+
const activeClass = 'bg-emerald-600 text-white hover:text-white md:!text-emerald-500'
|
|
66
|
+
|
|
67
|
+
const toggleNavbar = () => {
|
|
68
|
+
navbarExpanded.value = !navbarExpanded.value
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const closeNavBar = () => {
|
|
72
|
+
navbarExpanded.value = false
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createPinia } from 'pinia'
|
|
2
|
+
import { createApp } from 'vue'
|
|
3
|
+
import Default from '@/layouts/default/Default.vue'
|
|
4
|
+
import App from './App.vue'
|
|
5
|
+
import { router } from './router'
|
|
6
|
+
|
|
7
|
+
const app = createApp(App)
|
|
8
|
+
|
|
9
|
+
app.component('LayoutDefault', Default)
|
|
10
|
+
app.use(createPinia())
|
|
11
|
+
app.use(router)
|
|
12
|
+
|
|
13
|
+
app.mount('#app')
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
2
|
+
import Home from '../views/Home.vue'
|
|
3
|
+
|
|
4
|
+
const history = createWebHashHistory()
|
|
5
|
+
const routes = [
|
|
6
|
+
{
|
|
7
|
+
path: '/',
|
|
8
|
+
name: 'Home',
|
|
9
|
+
component: Home,
|
|
10
|
+
meta: {
|
|
11
|
+
layout: 'default',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
path: '/about',
|
|
16
|
+
name: 'About',
|
|
17
|
+
// route level code-splitting
|
|
18
|
+
// this generates a separate chunk (about.[hash].js) for this route
|
|
19
|
+
// which is lazy-loaded when the route is visited.
|
|
20
|
+
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue'),
|
|
21
|
+
meta: {
|
|
22
|
+
layout: 'default',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
]
|
|
26
|
+
const router = createRouter({
|
|
27
|
+
linkActiveClass: 'active',
|
|
28
|
+
history,
|
|
29
|
+
routes,
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
export { router }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
|
|
3
|
+
export const useCounterStore = defineStore({
|
|
4
|
+
id: 'counter',
|
|
5
|
+
state: () => ({
|
|
6
|
+
counter: 0,
|
|
7
|
+
}),
|
|
8
|
+
getters: {
|
|
9
|
+
doubleCount: (state) => state.counter * 2,
|
|
10
|
+
},
|
|
11
|
+
actions: {
|
|
12
|
+
increment() {
|
|
13
|
+
this.counter++
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="mx-auto max-w-screen-xl px-4">
|
|
3
|
+
<div class="flex justify-center">
|
|
4
|
+
<div alt="Vue logo" class="mt-8 h-52 w-52 bg-[url('@/assets/logo.svg')] bg-no-repeat" />
|
|
5
|
+
</div>
|
|
6
|
+
<HelloWorld msg="Vue.js 3 starter template" class="mt-2" />
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import HelloWorld from '@/components/HelloWorld.vue'
|
|
12
|
+
|
|
13
|
+
defineOptions({
|
|
14
|
+
name: 'Home',
|
|
15
|
+
})
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx,mdx}'],
|
|
5
|
+
theme: {
|
|
6
|
+
fontFamily: {
|
|
7
|
+
sans: ['Inter', 'Helvetica', 'Arial', 'sans-serif'],
|
|
8
|
+
},
|
|
9
|
+
extend: {},
|
|
10
|
+
},
|
|
11
|
+
plugins: [],
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import HelloWorld from '@/components/HelloWorld.vue'
|
|
3
|
+
|
|
4
|
+
describe('HelloWorld', () => {
|
|
5
|
+
it('renders properly', () => {
|
|
6
|
+
const wrapper = mount(HelloWorld, { props: { msg: 'Hello Vitest' } })
|
|
7
|
+
|
|
8
|
+
expect(wrapper.text()).toContain('Hello Vitest')
|
|
9
|
+
})
|
|
10
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { beforeAll } from 'vitest'
|
|
2
|
+
|
|
3
|
+
beforeAll(() => {
|
|
4
|
+
globalThis.ResizeObserver = class ResizeObserver {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
6
|
+
constructor() {
|
|
7
|
+
//
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
disconnect() {
|
|
11
|
+
return null
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
observe() {
|
|
15
|
+
return null
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
unobserve() {
|
|
19
|
+
return null
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
})
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": [
|
|
3
|
+
"env.d.ts",
|
|
4
|
+
"src/**/*",
|
|
5
|
+
"src/**/*.vue",
|
|
6
|
+
"tests/**/*",
|
|
7
|
+
"tests/**/*.vue",
|
|
8
|
+
"vite.config.*",
|
|
9
|
+
],
|
|
10
|
+
"compilerOptions": {
|
|
11
|
+
"baseUrl": ".",
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"target": "ESNext",
|
|
14
|
+
"lib": [
|
|
15
|
+
"DOM",
|
|
16
|
+
"ESNext"
|
|
17
|
+
],
|
|
18
|
+
"strict": true,
|
|
19
|
+
"esModuleInterop": true,
|
|
20
|
+
"jsx": "preserve",
|
|
21
|
+
"skipLibCheck": true,
|
|
22
|
+
"moduleResolution": "Bundler",
|
|
23
|
+
"resolveJsonModule": true,
|
|
24
|
+
"noUnusedLocals": true,
|
|
25
|
+
"strictNullChecks": true,
|
|
26
|
+
"allowJs": true,
|
|
27
|
+
"forceConsistentCasingInFileNames": true,
|
|
28
|
+
"types": [
|
|
29
|
+
"vite/client",
|
|
30
|
+
"vitest/globals",
|
|
31
|
+
"jsdom",
|
|
32
|
+
"node",
|
|
33
|
+
],
|
|
34
|
+
"paths": {
|
|
35
|
+
"@/*": [
|
|
36
|
+
"./src/*"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"exclude": [
|
|
41
|
+
"dist",
|
|
42
|
+
"node_modules"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/// <reference types="vitest" />
|
|
2
|
+
|
|
3
|
+
import vue from '@vitejs/plugin-vue'
|
|
4
|
+
import { resolve } from 'path'
|
|
5
|
+
import { defineConfig, type Plugin } from 'vite'
|
|
6
|
+
|
|
7
|
+
const transformHtmlPlugin = (data: Record<string, string>): Plugin => ({
|
|
8
|
+
name: 'transform-html',
|
|
9
|
+
transformIndexHtml: {
|
|
10
|
+
order: 'pre',
|
|
11
|
+
handler(html: string) {
|
|
12
|
+
return html.replace(/<%=\s*(\w+)\s*%>/gi, (match, p1) => data[p1] || '')
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
plugins: [
|
|
19
|
+
vue(),
|
|
20
|
+
transformHtmlPlugin({
|
|
21
|
+
title: 'ProjectName',
|
|
22
|
+
description: 'A single page application created using Vue.js 3',
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
resolve: {
|
|
26
|
+
alias: {
|
|
27
|
+
'@': resolve(__dirname, '/src'),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
css: {
|
|
31
|
+
preprocessorOptions: {
|
|
32
|
+
scss: {
|
|
33
|
+
additionalData: `@import "./src/scss/variables";`,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
test: {
|
|
38
|
+
globals: true,
|
|
39
|
+
globalSetup: './tests/vitest.global-setup.ts',
|
|
40
|
+
setupFiles: ['./tests/vitest.globals.ts'],
|
|
41
|
+
environment: 'jsdom',
|
|
42
|
+
reporters: ['default'],
|
|
43
|
+
coverage: {
|
|
44
|
+
reporter: ['text', 'json'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
})
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kouts/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.2",
|
|
5
5
|
"packageManager": "pnpm@9.7.1",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
@@ -38,9 +38,6 @@
|
|
|
38
38
|
"main": "./dist/index.js",
|
|
39
39
|
"module": "./dist/index.js",
|
|
40
40
|
"types": "./dist/index.d.ts",
|
|
41
|
-
"files": [
|
|
42
|
-
"dist"
|
|
43
|
-
],
|
|
44
41
|
"scripts": {
|
|
45
42
|
"dev": "pkgroll --watch",
|
|
46
43
|
"build": "pkgroll --clean-dist",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
branches: [
|
|
3
|
+
'main',
|
|
4
|
+
{
|
|
5
|
+
name: 'beta',
|
|
6
|
+
prerelease: true,
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
name: 'next',
|
|
10
|
+
channel: 'next',
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
plugins: [
|
|
14
|
+
'@semantic-release/commit-analyzer',
|
|
15
|
+
'@semantic-release/release-notes-generator',
|
|
16
|
+
[
|
|
17
|
+
'@semantic-release/changelog',
|
|
18
|
+
{
|
|
19
|
+
changelogFile: 'CHANGELOG.md',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
'@semantic-release/npm',
|
|
23
|
+
'@semantic-release/github',
|
|
24
|
+
[
|
|
25
|
+
'@semantic-release/git',
|
|
26
|
+
{
|
|
27
|
+
assets: ['CHANGELOG.md'],
|
|
28
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
29
|
+
message: 'chore(release): set `package.json` to ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
],
|
|
33
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import pluginVitest from '@vitest/eslint-plugin'
|
|
3
|
+
import type { Linter } from 'eslint'
|
|
4
|
+
import pluginHtml from 'eslint-plugin-html'
|
|
5
|
+
import pluginImport from 'eslint-plugin-import-x'
|
|
6
|
+
import pluginPrettier from 'eslint-plugin-prettier/recommended'
|
|
7
|
+
import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort'
|
|
8
|
+
import neostandard, { type NeostandardOptions, plugins, resolveIgnoresFromGitignore } from 'neostandard'
|
|
9
|
+
import { typescript } from './typescript'
|
|
10
|
+
import { vue } from './vue'
|
|
11
|
+
|
|
12
|
+
type Options = {
|
|
13
|
+
vue?: boolean
|
|
14
|
+
vueVersion?: 2 | 3
|
|
15
|
+
vitest: boolean
|
|
16
|
+
} & NeostandardOptions
|
|
17
|
+
|
|
18
|
+
const config = (options?: Options) => {
|
|
19
|
+
const opts: Options = {
|
|
20
|
+
noJsx: true,
|
|
21
|
+
noStyle: true,
|
|
22
|
+
semi: false,
|
|
23
|
+
ts: true,
|
|
24
|
+
vue: true,
|
|
25
|
+
vueVersion: 3,
|
|
26
|
+
vitest: true,
|
|
27
|
+
...options,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const linterConfig: Linter.Config[] = [
|
|
31
|
+
{
|
|
32
|
+
name: 'kouts/ignores',
|
|
33
|
+
ignores: [
|
|
34
|
+
'**/node_modules/**',
|
|
35
|
+
'{tmp,temp}/**',
|
|
36
|
+
'**/*.min.js',
|
|
37
|
+
'vendor/**',
|
|
38
|
+
'dist/**',
|
|
39
|
+
'public/**',
|
|
40
|
+
...resolveIgnoresFromGitignore(),
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// JavaScript
|
|
45
|
+
{
|
|
46
|
+
name: 'kouts/javascript',
|
|
47
|
+
...js.configs.recommended,
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
// TypeScript
|
|
51
|
+
...(opts.ts ? typescript : []),
|
|
52
|
+
|
|
53
|
+
// Neostandard
|
|
54
|
+
...neostandard(opts),
|
|
55
|
+
{
|
|
56
|
+
name: 'kouts/neostandard-overrides',
|
|
57
|
+
rules: {
|
|
58
|
+
// Enforce blank lines between the given 2 kinds of statements
|
|
59
|
+
'padding-line-between-statements': [
|
|
60
|
+
'error',
|
|
61
|
+
{ blankLine: 'always', prev: '*', next: 'return' },
|
|
62
|
+
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
|
|
63
|
+
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
|
|
64
|
+
{ blankLine: 'always', prev: 'directive', next: '*' },
|
|
65
|
+
{ blankLine: 'any', prev: 'directive', next: 'directive' },
|
|
66
|
+
],
|
|
67
|
+
// Console and debugger settings depending whether we're on production or not
|
|
68
|
+
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
69
|
+
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
// Import
|
|
74
|
+
{
|
|
75
|
+
name: 'kouts/import',
|
|
76
|
+
plugins: {
|
|
77
|
+
import: pluginImport,
|
|
78
|
+
},
|
|
79
|
+
rules: {
|
|
80
|
+
'import/export': 'error',
|
|
81
|
+
'import/first': 'error',
|
|
82
|
+
'import/no-duplicates': 'error',
|
|
83
|
+
'import/no-mutable-exports': 'error',
|
|
84
|
+
'import/no-named-default': 'error',
|
|
85
|
+
'import/no-self-import': 'error',
|
|
86
|
+
'import/no-webpack-loader-syntax': 'error',
|
|
87
|
+
'import/no-absolute-path': ['error', { esmodule: true, commonjs: true, amd: false }],
|
|
88
|
+
'import/newline-after-import': ['error', { count: 1 }],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
// Sort imports
|
|
93
|
+
{
|
|
94
|
+
name: 'kouts/sort-imports',
|
|
95
|
+
plugins: {
|
|
96
|
+
'simple-import-sort': pluginSimpleImportSort,
|
|
97
|
+
},
|
|
98
|
+
rules: {
|
|
99
|
+
'simple-import-sort/imports': [
|
|
100
|
+
'error',
|
|
101
|
+
// Remove all blank lines between imports
|
|
102
|
+
{
|
|
103
|
+
groups: [['^\\u0000', '^node:', '^@?\\w', '^', '^\\.']],
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
'simple-import-sort/exports': 'error',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
// HTML
|
|
111
|
+
{
|
|
112
|
+
name: 'kouts/html',
|
|
113
|
+
files: ['**/*.html'],
|
|
114
|
+
plugins: {
|
|
115
|
+
html: pluginHtml,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
// Vue
|
|
120
|
+
...(opts.vue ? vue({ version: opts.vueVersion, ts: opts.ts }) : []),
|
|
121
|
+
|
|
122
|
+
// Vitest
|
|
123
|
+
...(opts.vitest
|
|
124
|
+
? [
|
|
125
|
+
{
|
|
126
|
+
name: 'kouts/vitest',
|
|
127
|
+
files: ['test/**', 'tests/**', '**/*.test.{js,ts}*', '**/*.spec.{js,ts}'],
|
|
128
|
+
plugins: {
|
|
129
|
+
vitest: pluginVitest,
|
|
130
|
+
},
|
|
131
|
+
rules: {
|
|
132
|
+
...pluginVitest.configs.recommended.rules,
|
|
133
|
+
},
|
|
134
|
+
languageOptions: {
|
|
135
|
+
globals: {
|
|
136
|
+
...pluginVitest.environments.env.globals,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
]
|
|
141
|
+
: []),
|
|
142
|
+
|
|
143
|
+
// Prettier
|
|
144
|
+
{
|
|
145
|
+
name: 'kouts/prettier',
|
|
146
|
+
...pluginPrettier,
|
|
147
|
+
},
|
|
148
|
+
]
|
|
149
|
+
|
|
150
|
+
return linterConfig
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export { config, plugins }
|