@vida0905/eslint-config 0.1.7 → 0.3.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.
package/README.md CHANGED
@@ -8,8 +8,7 @@ Self use eslint config, extends [antfu's config](https://github.com/antfu/eslint
8
8
 
9
9
  - More stricter rules.
10
10
  - Support `pinia`.
11
- - Set `semi` to `true`
12
- - Disable `formatter` and `jsx`
11
+ - Disable `jsx` by default.
13
12
 
14
13
  ### Setup
15
14
 
@@ -20,16 +19,17 @@ npm i -D @vida/eslint-config
20
19
  in `eslint.config.js`
21
20
 
22
21
  ```js
23
- import { vida } from '@vida0905/eslint-config';
22
+ import { vida } from '@vida0905/eslint-config'
24
23
 
25
- export default vida();
24
+ export default vida()
26
25
  ```
27
26
 
28
27
  in `.vscode/settings.json`, more info to [@antfu/eslint-config](https://github.com/antfu/eslint-config?tab=readme-ov-file#vs-code-support-auto-fix-on-save)
29
28
 
30
- ```json
29
+ ```jsonc
31
30
  {
32
31
  // Enable the ESlint flat config support
32
+ // (remove this if your ESLint extension above v3.0.5)
33
33
  "eslint.experimental.useFlatConfig": true,
34
34
 
35
35
  // Disable the default formatter, use eslint instead
@@ -42,6 +42,20 @@ in `.vscode/settings.json`, more info to [@antfu/eslint-config](https://github.c
42
42
  "source.organizeImports": "never"
43
43
  },
44
44
 
45
+ // Silent the stylistic rules in you IDE, but still auto fix them
46
+ "eslint.rules.customizations": [
47
+ { "rule": "style/*", "severity": "off" },
48
+ { "rule": "format/*", "severity": "off" },
49
+ { "rule": "*-indent", "severity": "off" },
50
+ { "rule": "*-spacing", "severity": "off" },
51
+ { "rule": "*-spaces", "severity": "off" },
52
+ { "rule": "*-order", "severity": "off" },
53
+ { "rule": "*-dangle", "severity": "off" },
54
+ { "rule": "*-newline", "severity": "off" },
55
+ { "rule": "*quotes", "severity": "off" },
56
+ { "rule": "*semi", "severity": "off" }
57
+ ],
58
+
45
59
  // Enable eslint for all supported languages
46
60
  "eslint.validate": [
47
61
  "javascript",
@@ -58,7 +72,12 @@ in `.vscode/settings.json`, more info to [@antfu/eslint-config](https://github.c
58
72
  "xml",
59
73
  "gql",
60
74
  "graphql",
61
- "astro"
75
+ "astro",
76
+ "css",
77
+ "less",
78
+ "scss",
79
+ "pcss",
80
+ "postcss"
62
81
  ]
63
82
  }
64
83
  ```
package/dist/index.d.ts CHANGED
@@ -13,6 +13,6 @@ type OptionsConfig = AntfuOptions & {
13
13
  pinia?: boolean;
14
14
  };
15
15
 
16
- declare function vida(options?: OptionsConfig, ...userConfigs: TypedFlatConfigItem[]): eslint_flat_config_utils.FlatConfigComposer<TypedFlatConfigItem, _antfu_eslint_config.ConfigNames>;
16
+ declare function vida(options?: OptionsConfig & TypedFlatConfigItem, ...userConfigs: TypedFlatConfigItem[]): eslint_flat_config_utils.FlatConfigComposer<TypedFlatConfigItem, _antfu_eslint_config.ConfigNames>;
17
17
 
18
18
  export { vida as default, vida };
package/dist/index.js CHANGED
@@ -54,9 +54,10 @@ function vida(options = {}, ...userConfigs) {
54
54
  stylistic: {
55
55
  indent: 2,
56
56
  quotes: "single",
57
- semi: true,
57
+ semi: false,
58
58
  overrides: {
59
- "style/arrow-parens": ["error", "always"]
59
+ "style/arrow-parens": ["error", "always"],
60
+ "style/brace-style": ["error", "1tbs", { allowSingleLine: true }]
60
61
  }
61
62
  },
62
63
  javascript: {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@vida0905/eslint-config",
3
3
  "type": "module",
4
- "version": "0.1.7",
5
- "packageManager": "pnpm@9.1.2",
4
+ "version": "0.3.0",
5
+ "packageManager": "pnpm@9.4.0",
6
6
  "description": "Vida Xie's ESLint Config",
7
7
  "author": "Vida Xie <vida_2020@163.com> (https://github.com/9romise/)",
8
8
  "license": "MIT",
@@ -36,18 +36,40 @@
36
36
  "build": "tsup",
37
37
  "release": "npm run lint && npm run typecheck && bumpp",
38
38
  "typecheck": "tsc --noEmit",
39
- "prepublish": "npm run build"
39
+ "prepack": "npm run build",
40
+ "prepare": "simple-git-hooks"
41
+ },
42
+ "peerDependencies": {
43
+ "@unocss/eslint-plugin": ">=0.50.0",
44
+ "eslint": ">=8.40.0",
45
+ "eslint-plugin-format": ">=0.1.0"
46
+ },
47
+ "peerDependenciesMeta": {
48
+ "@unocss/eslint-plugin": {
49
+ "optional": true
50
+ },
51
+ "eslint-plugin-format": {
52
+ "optional": true
53
+ }
40
54
  },
41
55
  "dependencies": {
42
- "@antfu/eslint-config": "^2.18.1",
56
+ "@antfu/eslint-config": "^2.21.1",
43
57
  "eslint-plugin-pinia": "^0.1.13",
44
58
  "local-pkg": "^0.5.0"
45
59
  },
46
60
  "devDependencies": {
47
- "@eslint/config-inspector": "^0.4.8",
61
+ "@eslint/config-inspector": "^0.5.0",
48
62
  "bumpp": "^9.4.1",
49
- "eslint": "^9.3.0",
50
- "tsup": "^8.0.2",
51
- "typescript": "^5.4.5"
63
+ "eslint": "^9.5.0",
64
+ "lint-staged": "^15.2.7",
65
+ "simple-git-hooks": "^2.11.1",
66
+ "tsup": "^8.1.0",
67
+ "typescript": "^5.5.2"
68
+ },
69
+ "simple-git-hooks": {
70
+ "pre-commit": "npx lint-staged"
71
+ },
72
+ "lint-staged": {
73
+ "*": "eslint --fix"
52
74
  }
53
75
  }
package/dist/index.cjs DELETED
@@ -1,120 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/index.ts
32
- var src_exports = {};
33
- __export(src_exports, {
34
- default: () => src_default,
35
- vida: () => vida
36
- });
37
- module.exports = __toCommonJS(src_exports);
38
- var import_eslint_config2 = __toESM(require("@antfu/eslint-config"), 1);
39
- var import_local_pkg = require("local-pkg");
40
-
41
- // src/configs/pinia.ts
42
- var import_eslint_config = require("@antfu/eslint-config");
43
- var import_eslint_plugin_pinia = __toESM(require("eslint-plugin-pinia"), 1);
44
- var GLOB_PINIA_JS = `stores/${import_eslint_config.GLOB_JS}`;
45
- var GLOB_PINIA_TS = `stores/${import_eslint_config.GLOB_TS}`;
46
- var pinia = [
47
- {
48
- name: "vida/pinia",
49
- files: [GLOB_PINIA_JS, GLOB_PINIA_TS],
50
- plugins: {
51
- pinia: import_eslint_plugin_pinia.default
52
- },
53
- rules: {
54
- "pinia/prefer-single-store-per-file": ["error"],
55
- "pinia/prefer-use-store-naming-convention": ["error", {
56
- checkStoreNameMismatch: true,
57
- storeSuffix: "Store"
58
- }],
59
- "pinia/require-setup-store-properties-export": ["warn"],
60
- "pinia/no-duplicate-store-ids": ["error"]
61
- }
62
- }
63
- ];
64
-
65
- // src/overrides/javascript.ts
66
- var javascript = {
67
- "arrow-body-style": ["error", "as-needed"],
68
- "no-unused-private-class-members": "error",
69
- "require-atomic-updates": ["error", { allowProperties: true }]
70
- };
71
-
72
- // src/overrides/vue.ts
73
- var vue = {
74
- "vue/max-attributes-per-line": ["error", {
75
- singleline: 5,
76
- multiline: 1
77
- }]
78
- };
79
-
80
- // src/index.ts
81
- __reExport(src_exports, require("@antfu/eslint-config"), module.exports);
82
- function vida(options = {}, ...userConfigs) {
83
- const {
84
- pinia: enablePinia = (0, import_local_pkg.isPackageExists)("pinia")
85
- } = options;
86
- const configs = [];
87
- if (enablePinia)
88
- configs.push(pinia);
89
- const antfuConfig = {
90
- stylistic: {
91
- indent: 2,
92
- quotes: "single",
93
- semi: true,
94
- overrides: {
95
- "style/arrow-parens": ["error", "always"]
96
- }
97
- },
98
- javascript: {
99
- overrides: javascript
100
- },
101
- vue: {
102
- overrides: vue
103
- },
104
- jsx: false
105
- };
106
- return (0, import_eslint_config2.default)(
107
- {
108
- ...antfuConfig,
109
- ...options
110
- },
111
- ...configs,
112
- ...userConfigs
113
- );
114
- }
115
- var src_default = vida;
116
- // Annotate the CommonJS export names for ESM import in node:
117
- 0 && (module.exports = {
118
- vida,
119
- ...require("@antfu/eslint-config")
120
- });
package/dist/index.d.cts DELETED
@@ -1,18 +0,0 @@
1
- import * as eslint_flat_config_utils from 'eslint-flat-config-utils';
2
- import * as _antfu_eslint_config from '@antfu/eslint-config';
3
- import { antfu, TypedFlatConfigItem } from '@antfu/eslint-config';
4
- export * from '@antfu/eslint-config';
5
-
6
- type AntfuOptions = Parameters<typeof antfu>[0];
7
- type OptionsConfig = AntfuOptions & {
8
- /**
9
- * Enable Pinia support.
10
- *
11
- * @default auto-detect based on the dependencies
12
- */
13
- pinia?: boolean;
14
- };
15
-
16
- declare function vida(options?: OptionsConfig, ...userConfigs: TypedFlatConfigItem[]): eslint_flat_config_utils.FlatConfigComposer<TypedFlatConfigItem, _antfu_eslint_config.ConfigNames>;
17
-
18
- export { vida as default, vida };