Skip to content

Commit bd3e6cb

Browse files
committed
fix: 解决组件样式引入的问题
1 parent 1f9a7d5 commit bd3e6cb

File tree

15 files changed

+339
-153
lines changed

15 files changed

+339
-153
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
"mockjs",
126126
"nprogress",
127127
"nutui",
128+
"nuxt",
128129
"persistedstate",
129130
"pinia",
130131
"pnpm",

build/vite/plugins/component.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,7 @@
55

66
import Components from 'unplugin-vue-components/vite';
77
import { VueUseComponentsResolver, VantResolver, VarletUIResolver } from 'unplugin-vue-components/resolvers';
8-
9-
const NutUIResolver = () => {
10-
return (name) => {
11-
if (name.startsWith('Nut')) {
12-
const partialName = name.slice(3);
13-
return {
14-
name: partialName,
15-
from: '@nutui/nutui',
16-
sideEffects: `@nutui/nutui/dist/packages/${partialName.toLowerCase()}/style`,
17-
};
18-
}
19-
};
20-
};
8+
import NutUIResolver from '@nutui/auto-import-resolver';
219

2210
export const AutoRegistryComponents = () => {
2311
return Components({

eslint.config.mjs

Lines changed: 24 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,28 @@
1-
// eslint.config.js
1+
import eslint from '@eslint/js';
2+
import eslintConfigPrettier from 'eslint-config-prettier';
3+
import eslintPluginVue from 'eslint-plugin-vue';
4+
import globals from 'globals';
5+
import typescriptEslint from 'typescript-eslint';
26

3-
import { defineConfig } from 'eslint-define-config';
4-
5-
export default defineConfig({
6-
env: {
7-
browser: true,
8-
node: true,
9-
es6: true,
10-
},
11-
parser: 'vue-eslint-parser',
12-
parserOptions: {
13-
parser: '@typescript-eslint/parser',
14-
ecmaVersion: 2020,
15-
sourceType: 'module',
16-
jsxPragma: 'React',
17-
ecmaFeatures: {
18-
jsx: true,
19-
},
20-
project: './tsconfig.*?.json',
21-
createDefaultProgram: false,
22-
extraFileExtensions: ['.vue'],
23-
},
24-
extends: [
25-
'plugin:vue/vue3-recommended',
26-
'plugin:@typescript-eslint/recommended',
27-
'plugin:prettier/recommended',
28-
],
29-
plugins: ['vue', '@typescript-eslint', 'import'],
30-
rules: {
31-
'no-unused-vars': 'off',
32-
'no-case-declarations': 'off',
33-
'no-use-before-define': 'off',
34-
'space-before-function-paren': 'off',
35-
'import/first': 'error',
36-
'import/newline-after-import': 'error',
37-
'import/no-duplicates': 'error',
38-
'@typescript-eslint/no-unused-vars': [
39-
'error',
40-
{
41-
argsIgnorePattern: '^_',
42-
varsIgnorePattern: '^_',
43-
},
44-
],
45-
'@typescript-eslint/ban-ts-ignore': 'off',
46-
'@typescript-eslint/ban-ts-comment': 'off',
47-
'@typescript-eslint/ban-types': 'off',
48-
'@typescript-eslint/explicit-function-return-type': 'off',
49-
'@typescript-eslint/no-explicit-any': 'off',
50-
'@typescript-eslint/no-var-requires': 'off',
51-
'@typescript-eslint/no-empty-function': 'off',
52-
'@typescript-eslint/no-use-before-define': 'off',
53-
'@typescript-eslint/no-non-null-assertion': 'off',
54-
'@typescript-eslint/explicit-module-boundary-types': 'off',
55-
'vue/script-setup-uses-vars': 'error',
56-
'vue/no-reserved-component-names': 'off',
57-
'vue/custom-event-name-casing': 'off',
58-
'vue/attributes-order': 'off',
59-
'vue/one-component-per-file': 'off',
60-
'vue/html-closing-bracket-newline': 'off',
61-
'vue/max-attributes-per-line': 'off',
62-
'vue/multiline-html-element-content-newline': 'off',
63-
'vue/singleline-html-element-content-newline': 'off',
64-
'vue/attribute-hyphenation': 'off',
65-
'vue/require-default-prop': 'off',
66-
'vue/require-explicit-emits': 'off',
67-
'vue/html-self-closing': [
68-
'error',
69-
{
70-
html: {
71-
void: 'always',
72-
normal: 'never',
73-
component: 'always',
7+
export default typescriptEslint.config(
8+
{ ignores: ['*.d.ts', '**/coverage', '**/dist'] },
9+
{
10+
extends: [eslint.configs.recommended, ...typescriptEslint.configs.recommended, ...eslintPluginVue.configs['flat/recommended']],
11+
files: ['**/*.{ts,vue}'],
12+
languageOptions: {
13+
ecmaVersion: 'latest',
14+
sourceType: 'module',
15+
globals: globals.browser,
16+
parserOptions: {
17+
parser: typescriptEslint.parser,
18+
ecmaFeatures: {
19+
jsx: true,
7420
},
75-
svg: 'always',
76-
math: 'always',
7721
},
78-
],
79-
'vue/multi-word-component-names': 'off',
22+
},
23+
rules: {
24+
'vue/multi-word-component-names': 'off',
25+
},
8026
},
81-
globals: { defineOptions: 'readonly' },
82-
ignores: [
83-
'**/*.sh',
84-
'node_modules',
85-
'**/*.md',
86-
'**/*.woff',
87-
'**/*.ttf',
88-
'.vscode',
89-
'.idea',
90-
'dist',
91-
'public',
92-
'docs',
93-
'.husky',
94-
'.local',
95-
'bin',
96-
'Dockerfile',
97-
],
98-
});
27+
eslintConfigPrettier,
28+
);

package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
"devDependencies": {
3535
"@commitlint/cli": "^19.7.1",
3636
"@commitlint/config-conventional": "^19.7.1",
37+
"@eslint/js": "^9.20.0",
38+
"@nutui/auto-import-resolver": "^1.0.0",
39+
"@stylistic/stylelint-plugin": "^3.1.2",
40+
"@typescript-eslint/parser": "^8.24.1",
3741
"@vitejs/plugin-basic-ssl": "^1.2.0",
3842
"@vitejs/plugin-legacy": "^6.0.1",
3943
"@vitejs/plugin-vue": "^5.2.1",
@@ -58,6 +62,7 @@
5862
"eslint-plugin-simple-import-sort": "^12.1.1",
5963
"eslint-plugin-vue": "^9.32.0",
6064
"git-cz": "^4.9.0",
65+
"globals": "^15.15.0",
6166
"husky": "9.1.7",
6267
"jsdom": "^22.1.0",
6368
"lint-staged": "15.4.3",
@@ -70,14 +75,17 @@
7075
"rollup-plugin-visualizer": "^5.9.1",
7176
"stylelint": "^15.10.1",
7277
"stylelint-config-property-sort-order-smacss": "^9.1.0",
78+
"stylelint-config-recess-order": "^6.0.0",
7379
"stylelint-config-recommended": "^13.0.0",
7480
"stylelint-config-recommended-vue": "^1.5.0",
7581
"stylelint-config-standard": "^34.0.0",
7682
"stylelint-config-standard-scss": "^10.0.0",
7783
"stylelint-order": "^6.0.3",
7884
"stylelint-prettier": "^4.0.0",
85+
"stylelint-scss": "^6.11.0",
7986
"terser": "^5.19.0",
8087
"typescript": "^5.7.3",
88+
"typescript-eslint": "^8.24.1",
8189
"unplugin-auto-import": "^19.1.0",
8290
"unplugin-vue-components": "^28.2.0",
8391
"vite": "^6.1.0",

0 commit comments

Comments
 (0)