Skip to content

Commit

Permalink
refactor(projects): use eslint flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Jan 18, 2024
1 parent 24df68d commit 5f7bc70
Show file tree
Hide file tree
Showing 49 changed files with 1,276 additions and 1,102 deletions.
7 changes: 0 additions & 7 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
registry=https://registry.npmmirror.com/
shamefully-hoist=true
ignore-workspace-root-check=true
22 changes: 5 additions & 17 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
{
"cSpell.words": ["consola", "iife", "kolorist", "magicast", "tsup", "unplugin"],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
"editor.fontLigatures": true,
"eslint.experimental.useFlatConfig": true,
"editor.formatOnSave": false,
"editor.quickSuggestions": {
"strings": true
},
"editor.tabSize": 2,
"eslint.validate": ["svelte", "astro", "json"],
"files.associations": {
"*.env.*": "dotenv",
"*.svg": "html"
},
"files.eol": "\n",
"[html][css][less][scss][sass][markdown][yaml][yml][jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
"eslint.validate": ["html", "css", "scss", "json", "jsonc"],
"prettier.enable": false
}
16 changes: 16 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineConfig } from '@soybeanjs/eslint-config';

export default defineConfig(
{ vue: true },
{
rules: {
'vue/multi-word-component-names': [
'warn',
{
ignores: ['index', 'App', '[id]']
}
],
'max-params': ['error', 4]
}
}
);
8 changes: 4 additions & 4 deletions examples/template-vue/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
Expand Down
12 changes: 6 additions & 6 deletions examples/template-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "template-vue",
"type": "module",
"version": "0.3.2",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"debug": "vite --debug",
"build": "run-s type-check build-only",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit --skipLibCheck",
"lint": "eslint . --fix"
"debug": "vite --debug",
"dev": "vite",
"lint": "eslint . --fix",
"preview": "vite preview",
"type-check": "vue-tsc --noEmit --skipLibCheck"
},
"dependencies": {
"@elegant-router/vue": "workspace:*",
Expand Down
19 changes: 16 additions & 3 deletions examples/template-vue/src/assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,23 @@ body {
min-height: 100vh;
color: var(--color-text);
background: var(--color-background);
transition: color 0.5s, background-color 0.5s;
transition:
color 0.5s,
background-color 0.5s;
line-height: 1.6;
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-family:
Inter,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Fira Sans',
'Droid Sans',
'Helvetica Neue',
sans-serif;
font-size: 15px;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
Expand Down
4 changes: 2 additions & 2 deletions examples/template-vue/src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ defineProps<{
<h1 class="green">{{ msg }}</h1>
<h3>
You’ve successfully created a project with
<a href="https://vitejs.dev/" target="_blank" rel="noopener">Vite</a>
<a href="https://vitejs.dev/" target="_blank" rel="noopener noreferrer">Vite</a>
+
<a href="https://vuejs.org/" target="_blank" rel="noopener">Vue 3</a>
<a href="https://vuejs.org/" target="_blank" rel="noopener noreferrer">Vue 3</a>
. What's next?
</h3>
</div>
Expand Down
34 changes: 18 additions & 16 deletions examples/template-vue/src/components/TheWelcome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import SupportIcon from './icons/IconSupport.vue';
<template #heading>Documentation</template>

Vue’s
<a href="https://vuejs.org/" target="_blank" rel="noopener">official documentation</a>
<a href="https://vuejs.org/" target="_blank" rel="noopener noreferrer">official documentation</a>
provides you with all information you need to get started.
</WelcomeItem>

Expand All @@ -26,15 +26,15 @@ import SupportIcon from './icons/IconSupport.vue';
<template #heading>Tooling</template>

This project is served and bundled with
<a href="https://vitejs.dev/guide/features.html" target="_blank" rel="noopener">Vite</a>
<a href="https://vitejs.dev/guide/features.html" target="_blank" rel="noopener noreferrer">Vite</a>
. The recommended IDE setup is
<a href="https://code.visualstudio.com/" target="_blank" rel="noopener">VSCode</a>
<a href="https://code.visualstudio.com/" target="_blank" rel="noopener noreferrer">VSCode</a>
+
<a href="https://github.com/johnsoncodehk/volar" target="_blank" rel="noopener">Volar</a>
<a href="https://github.com/johnsoncodehk/volar" target="_blank" rel="noopener noreferrer">Volar</a>
. If you need to test your components and web pages, check out
<a href="https://www.cypress.io/" target="_blank" rel="noopener">Cypress</a>
<a href="https://www.cypress.io/" target="_blank" rel="noopener noreferrer">Cypress</a>
and
<a href="https://on.cypress.io/component" target="_blank">Cypress Component Testing</a>
<a href="https://on.cypress.io/component" target="_blank" rel="noopener noreferrer">Cypress Component Testing</a>
.

<br />
Expand All @@ -51,15 +51,15 @@ import SupportIcon from './icons/IconSupport.vue';
<template #heading>Ecosystem</template>

Get official tools and libraries for your project:
<a href="https://pinia.vuejs.org/" target="_blank" rel="noopener">Pinia</a>
<a href="https://pinia.vuejs.org/" target="_blank" rel="noopener noreferrer">Pinia</a>
,
<a href="https://router.vuejs.org/" target="_blank" rel="noopener">Vue Router</a>
<a href="https://router.vuejs.org/" target="_blank" rel="noopener noreferrer">Vue Router</a>
,
<a href="https://test-utils.vuejs.org/" target="_blank" rel="noopener">Vue Test Utils</a>
<a href="https://test-utils.vuejs.org/" target="_blank" rel="noopener noreferrer">Vue Test Utils</a>
, and
<a href="https://github.com/vuejs/devtools" target="_blank" rel="noopener">Vue Dev Tools</a>
<a href="https://github.com/vuejs/devtools" target="_blank" rel="noopener noreferrer">Vue Dev Tools</a>
. If you need more resources, we suggest paying
<a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">Awesome Vue</a>
<a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener noreferrer">Awesome Vue</a>
a visit.
</WelcomeItem>

Expand All @@ -70,13 +70,15 @@ import SupportIcon from './icons/IconSupport.vue';
<template #heading>Community</template>

Got stuck? Ask your question on
<a href="https://chat.vuejs.org" target="_blank" rel="noopener">Vue Land</a>
<a href="https://chat.vuejs.org" target="_blank" rel="noopener noreferrer">Vue Land</a>
, our official Discord server, or
<a href="https://stackoverflow.com/questions/tagged/vue.js" target="_blank" rel="noopener">StackOverflow</a>
<a href="https://stackoverflow.com/questions/tagged/vue.js" target="_blank" rel="noopener noreferrer">
StackOverflow
</a>
. You should also subscribe to
<a href="https://news.vuejs.org" target="_blank" rel="noopener">our mailing list</a>
<a href="https://news.vuejs.org" target="_blank" rel="noopener noreferrer">our mailing list</a>
and follow the official
<a href="https://twitter.com/vuejs" target="_blank" rel="noopener">@vuejs</a>
<a href="https://twitter.com/vuejs" target="_blank" rel="noopener noreferrer">@vuejs</a>
twitter account for latest news in the Vue world.
</WelcomeItem>

Expand All @@ -87,7 +89,7 @@ import SupportIcon from './icons/IconSupport.vue';
<template #heading>Support Vue</template>

As an independent project, Vue relies on community backing for its sustainability. You can help us by
<a href="https://vuejs.org/sponsor/" target="_blank" rel="noopener">becoming a sponsor</a>
<a href="https://vuejs.org/sponsor/" target="_blank" rel="noopener noreferrer">becoming a sponsor</a>
.
</WelcomeItem>
</template>
16 changes: 8 additions & 8 deletions examples/template-vue/src/layouts/base-layout/index.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
<template>
<div>
<header>头部</header>
<RouterView />
<footer>底部</footer>
</div>
</template>

<script setup lang="ts">
import { RouterView } from 'vue-router';
Expand All @@ -14,4 +6,12 @@ defineOptions({
});
</script>

<template>
<div>
<header>头部</header>
<RouterView />
<footer>底部</footer>
</div>
</template>

<style scoped></style>
12 changes: 6 additions & 6 deletions examples/template-vue/src/layouts/blank-layout/index.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
<template>
<div>
<RouterView />
</div>
</template>

<script setup lang="ts">
import { RouterView } from 'vue-router';
Expand All @@ -12,4 +6,10 @@ defineOptions({
});
</script>

<template>
<div>
<RouterView />
</div>
</template>

<style scoped></style>
2 changes: 1 addition & 1 deletion examples/template-vue/src/router/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ElegantRoute, CustomRoute } from '@elegant-router/types';
import type { CustomRoute, ElegantRoute } from '@elegant-router/types';
import { generatedRoutes } from '../elegant/routes';
import { layouts, views } from '../elegant/imports';
import { transformElegantRoutesToVueRoutes } from '../elegant/transform';
Expand Down
2 changes: 1 addition & 1 deletion examples/template-vue/src/stores/counter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ref, computed } from 'vue';
import { computed, ref } from 'vue';
import { defineStore } from 'pinia';

export const useCounterStore = defineStore('counter', () => {
Expand Down
24 changes: 12 additions & 12 deletions examples/template-vue/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"compilerOptions": {
"baseUrl": ".",
"module": "ESNext",
"target": "ESNext",
"lib": ["DOM", "ESNext"],
"strict": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"jsx": "preserve",
"jsxImportSource": "vue",
"lib": ["DOM", "ESNext"],
"baseUrl": ".",
"module": "ESNext",
"moduleResolution": "node",
"isolatedModules": true,
"resolveJsonModule": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"@/*": ["./src/*"]
},
"types": ["vite/client", "node"]
"resolveJsonModule": true,
"types": ["vite/client", "node"],
"strict": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true
},
"exclude": ["node_modules", "dist"]
}
2 changes: 1 addition & 1 deletion examples/template-vue/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fileURLToPath, URL } from 'node:url';
import { URL, fileURLToPath } from 'node:url';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
Expand Down
22 changes: 13 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "elegant-router",
"type": "module",
"version": "0.3.2",
"description": "A plugin to create router elegantly",
"private": true,
"packageManager": "[email protected]",
"description": "A plugin to create router elegantly",
"author": {
"name": "Soybean",
"email": "[email protected]",
Expand All @@ -19,21 +20,24 @@
},
"scripts": {
"build": "pnpm -r --filter='./packages/*' run build",
"stub": "pnpm -r --parallel --filter='./packages/*' run stub",
"lint": "eslint . --fix",
"format": "soy prettier-write",
"commit": "soy git-commit",
"cleanup": "soy cleanup",
"update-pkg": "soy ncu",
"commit": "soy git-commit",
"format": "soy prettier-write",
"lint": "eslint . --fix",
"prepare": "pnpm -r run stub",
"publish-pkg": "pnpm -r publish --access public",
"release": "pnpm soy release",
"prepare": "pnpm -r run stub"
"stub": "pnpm -r --parallel --filter='./packages/*' run stub",
"update-pkg": "soy ncu"
},
"devDependencies": {
"@soybeanjs/cli": "1.0.2",
"@soybeanjs/eslint-config": "1.1.6",
"eslint": "8.56.0",
"eslint-config-soybeanjs": "0.5.8",
"eslint-plugin-vue": "9.20.1",
"simple-git-hooks": "2.9.0",
"tsx": "4.7.0"
"tsx": "4.7.0",
"typescript": "5.3.3",
"vue-eslint-parser": "9.4.0"
}
}
12 changes: 5 additions & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,20 @@
"bugs": {
"url": "https://github.com/soybeanjs/elegant-router/issues"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"types": "./dist/index.d.ts",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"files": [
"dist"
],
"types": "./dist/index.d.ts",
"files": ["dist"],
"scripts": {
"build": "pnpm typecheck && unbuild",
"stub": "unbuild --stub",
Expand Down
Loading

0 comments on commit 5f7bc70

Please sign in to comment.