my-code-style 1.2.0 → 1.4.0

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.
@@ -12,26 +12,26 @@ export default [
12
12
  // Vue 3 essential rules
13
13
  ...pluginVue.configs["flat/essential"].map((config) => ({
14
14
  ...config,
15
- files: ["**/*.vue"],
15
+ files: ["**/*.{vue,nvue}"],
16
16
  })),
17
17
 
18
18
  // Vue plugin setup and custom overrides
19
19
  {
20
- files: ["**/*.vue"],
20
+ files: ["**/*.{vue,nvue}"],
21
21
  languageOptions: {
22
22
  parser: parserVue,
23
23
  parserOptions: {
24
24
  parser: tseslint.parser,
25
25
  sourceType: "module",
26
26
  ecmaVersion: "latest",
27
- extraFileExtensions: [".vue"],
27
+ extraFileExtensions: [".vue", ".nvue"],
28
28
  },
29
29
  },
30
30
  rules: {
31
31
  "vue/multi-word-component-names": "off",
32
32
  "@typescript-eslint/no-explicit-any": "off",
33
33
  "vue/no-mutating-props": ["error", { shallowOnly: true }],
34
- "vue/html-indent": ["error", 4],
34
+ "vue/html-indent": "off",
35
35
  "vue/script-indent": "off",
36
36
  "vue/html-self-closing": "off",
37
37
  "vue/max-attributes-per-line": "off",
@@ -41,15 +41,16 @@ export default [
41
41
 
42
42
  // .nvue specific overrides
43
43
  {
44
- files: ["*.nvue"],
44
+ files: ["**/*.nvue"],
45
45
  languageOptions: {
46
46
  parserOptions: {
47
- sourceType: "script",
47
+ sourceType: "module",
48
48
  },
49
49
  },
50
50
  rules: {
51
51
  "vue/comment-directive": "off",
52
+ // Prettier cannot infer a parser from the custom .nvue extension.
53
+ "prettier/prettier": ["error", { parser: "vue", semi: true }],
52
54
  },
53
55
  },
54
56
  ]
55
-
@@ -4,32 +4,40 @@ const base = require("./base.cjs")
4
4
  module.exports = {
5
5
  ...base,
6
6
  parser: "vue-eslint-parser",
7
- extends: [...base.extends, "plugin:vue/vue3-essential"],
7
+ extends: [...base.extends, "plugin:vue/essential"],
8
8
  parserOptions: {
9
9
  ...base.parserOptions,
10
10
  parser: "@typescript-eslint/parser",
11
- extraFileExtensions: [".vue"],
11
+ extraFileExtensions: [".vue", ".nvue"],
12
12
  },
13
13
  plugins: [...base.plugins, "vue"],
14
14
  overrides: [
15
15
  {
16
16
  env: { node: true },
17
- files: [".eslintrc.{js,cjs}", "*.nvue"],
17
+ files: [".eslintrc.{js,cjs}"],
18
18
  parserOptions: { sourceType: "script" },
19
19
  rules: { "vue/comment-directive": "off" },
20
20
  },
21
21
  ...(base.overrides || []),
22
+ {
23
+ files: ["**/*.nvue"],
24
+ parserOptions: { sourceType: "module" },
25
+ rules: {
26
+ "vue/comment-directive": "off",
27
+ semi: "off",
28
+ "prettier/prettier": ["error", { parser: "vue", semi: true }],
29
+ },
30
+ },
22
31
  ],
23
32
  rules: {
24
33
  ...base.rules,
25
34
  "vue/multi-word-component-names": "off",
26
35
  "@typescript-eslint/no-explicit-any": "off",
27
36
  "vue/no-mutating-props": ["error", { shallowOnly: true }],
28
- "vue/html-indent": ["error", 4],
37
+ "vue/html-indent": "off",
29
38
  "vue/script-indent": "off",
30
39
  "vue/html-self-closing": "off",
31
40
  "vue/max-attributes-per-line": "off",
32
41
  "vue/singleline-html-element-content-newline": "off",
33
42
  },
34
43
  }
35
-
package/src/gitignore ADDED
@@ -0,0 +1,10 @@
1
+ node_modules/
2
+ dist/
3
+ coverage/
4
+ *.local
5
+ *.log
6
+ .DS_Store
7
+ .idea/
8
+ .vscode/
9
+ *.tgz
10
+ .eslintcache
@@ -1,4 +1 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npx --no-install commitlint --edit
1
+ npx --no-install commitlint --edit "${1}"
@@ -1,4 +1 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
1
  npx --no-install -- lint-staged
@@ -24,8 +24,7 @@ module.exports = {
24
24
  },
25
25
  {
26
26
  files: "*.nvue",
27
- options: { semi: true },
27
+ options: { parser: "vue", semi: true },
28
28
  },
29
29
  ],
30
30
  }
31
-
@@ -9,9 +9,17 @@ module.exports = {
9
9
  "stylelint-config-recess-order",
10
10
  ],
11
11
  plugins: ["stylelint-prettier"],
12
+ ignoreFiles: [
13
+ "**/node_modules/**",
14
+ "**/dist/**",
15
+ "**/coverage/**",
16
+ "**/public/**",
17
+ "**/assets/iconfont/**",
18
+ "**/*.min.css",
19
+ ],
12
20
  overrides: [
13
21
  {
14
- files: ["**/*.{vue,html}"],
22
+ files: ["**/*.{vue,nvue,html}"],
15
23
  customSyntax: "postcss-html",
16
24
  },
17
25
  {
@@ -51,5 +59,18 @@ module.exports = {
51
59
  "scss/comment-no-empty": null,
52
60
  "selector-class-pattern": null,
53
61
  "font-family-no-missing-generic-family-keyword": null,
62
+ // 现代 CSS 语法与选择器宽松放行
63
+ "selector-not-notation": null,
64
+ "import-notation": null,
65
+ "media-feature-range-notation": null,
66
+ "no-descending-specificity": null,
67
+ // 业务样式容错放行
68
+ "block-no-empty": null,
69
+ "scss/at-extend-no-missing-placeholder": null,
70
+ // 兼容混合 Less 及 Vue 内嵌 Less 语法,避免 stylelint-scss 规则解析崩溃或误报
71
+ "scss/operator-no-newline-after": null,
72
+ "scss/operator-no-newline-before": null,
73
+ "scss/operator-no-unspaced": null,
74
+ "scss/no-global-function-names": null,
54
75
  },
55
76
  }
@@ -8,9 +8,17 @@ module.exports = {
8
8
  "stylelint-config-recess-order",
9
9
  ],
10
10
  plugins: ["stylelint-prettier"],
11
+ ignoreFiles: [
12
+ "**/node_modules/**",
13
+ "**/dist/**",
14
+ "**/coverage/**",
15
+ "**/public/**",
16
+ "**/assets/iconfont/**",
17
+ "**/*.min.css",
18
+ ],
11
19
  overrides: [
12
20
  {
13
- files: ["**/*.{vue,html}"],
21
+ files: ["**/*.{vue,nvue,html}"],
14
22
  customSyntax: "postcss-html",
15
23
  },
16
24
  {
@@ -45,5 +53,12 @@ module.exports = {
45
53
  "no-duplicate-selectors": null,
46
54
  "selector-class-pattern": null,
47
55
  "font-family-no-missing-generic-family-keyword": null,
56
+ // 现代 CSS 语法与选择器宽松放行
57
+ "selector-not-notation": null,
58
+ "import-notation": null,
59
+ "media-feature-range-notation": null,
60
+ "no-descending-specificity": null,
61
+ // 业务样式容错放行
62
+ "block-no-empty": null,
48
63
  },
49
- }
64
+ }