@wongxy/eslint-config 4.0.0 → 4.0.1

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/package.json CHANGED
@@ -1,31 +1,18 @@
1
1
  {
2
2
  "name": "@wongxy/eslint-config",
3
3
  "type": "module",
4
- "version": "4.0.0",
4
+ "version": "4.0.1",
5
5
  "description": "xiyaowong's eslint config",
6
6
  "author": "xiyaowong (https://github.com/xiyaowong)",
7
7
  "license": "MIT",
8
8
  "exports": {
9
- ".": "./dist/index.js"
9
+ ".": "./dist/index.mjs",
10
+ "./package.json": "./package.json"
10
11
  },
11
- "main": "dist/index.js",
12
- "types": "./dist/index.d.ts",
12
+ "types": "./dist/index.d.mts",
13
13
  "files": [
14
14
  "dist"
15
15
  ],
16
- "scripts": {
17
- "build": "nr typegen && tsdown --clean --dts",
18
- "stub": "tsdown --format esm",
19
- "watch": "tsdown --watch",
20
- "dev": "tsdown --watch & eslint-flat-config-viewer",
21
- "lint:fix": "eslint . --fix",
22
- "lint": "eslint .",
23
- "prepack": "pnpm run build",
24
- "release": "bumpp && pnpm publish",
25
- "inspect": "nlx @eslint/config-inspector",
26
- "typegen": "esno scripts/typegen.ts",
27
- "typecheck": "tsc --noEmit"
28
- },
29
16
  "peerDependencies": {
30
17
  "@eslint-react/eslint-plugin": "^5.18.6",
31
18
  "@next/eslint-plugin-next": "^16.0.1",
@@ -51,5 +38,17 @@
51
38
  "esno": "^4.8.0",
52
39
  "tsdown": "^0.22.14",
53
40
  "typescript": "^5.9.3"
41
+ },
42
+ "scripts": {
43
+ "build": "nr typegen && tsdown --clean --dts",
44
+ "stub": "tsdown --format esm",
45
+ "watch": "tsdown --watch",
46
+ "dev": "tsdown --watch & eslint-flat-config-viewer",
47
+ "lint:fix": "eslint . --fix",
48
+ "lint": "eslint .",
49
+ "release": "bumpp && pnpm publish",
50
+ "inspect": "nlx @eslint/config-inspector",
51
+ "typegen": "esno scripts/typegen.ts",
52
+ "typecheck": "tsc --noEmit"
54
53
  }
55
- }
54
+ }
package/dist/index.cjs DELETED
@@ -1,149 +0,0 @@
1
- //#region \0rolldown/runtime.js
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 __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
- //#endregion
23
- let _antfu_eslint_config = require("@antfu/eslint-config");
24
- let local_pkg = require("local-pkg");
25
- let eslint_plugin_better_tailwindcss = require("eslint-plugin-better-tailwindcss");
26
- eslint_plugin_better_tailwindcss = __toESM(eslint_plugin_better_tailwindcss, 1);
27
- //#region src/tailwindcss.ts
28
- async function tailwindcss(options = {}) {
29
- const { overrides = {}, settings } = options;
30
- const rules = {
31
- "tw/enforce-consistent-class-order": "warn",
32
- "tw/enforce-consistent-line-wrapping": ["warn", { printWidth: 100 }],
33
- "tw/no-duplicate-classes": "warn",
34
- "tw/no-unnecessary-whitespace": "warn",
35
- "tw/no-conflicting-classes": "warn",
36
- "tw/no-unknown-classes": "warn"
37
- };
38
- return [{
39
- name: "wongxy/tailwindcss/setup",
40
- plugins: { tw: eslint_plugin_better_tailwindcss.default },
41
- languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
42
- ...!!settings && { settings: { "better-tailwindcss": settings } }
43
- }, {
44
- name: "wongxy/tailwindcss/rules",
45
- rules: {
46
- ...rules,
47
- ...overrides
48
- }
49
- }];
50
- }
51
- //#endregion
52
- //#region src/index.ts
53
- const VuePackages = [
54
- "vue",
55
- "nuxt",
56
- "vitepress",
57
- "@slidev/cli"
58
- ];
59
- const ReactPackages = [
60
- "react",
61
- "react-native",
62
- "react-dom",
63
- "next"
64
- ];
65
- function resolveRules(overrides, rules) {
66
- return Object.fromEntries(Object.entries(rules).filter(([k]) => !overrides[k]));
67
- }
68
- function wongxy(options = {}, ...userConfigs) {
69
- const { react: enableReact = ReactPackages.some((i) => (0, local_pkg.isPackageExists)(i)), typescript: enableTypeScript = (0, local_pkg.isPackageExists)("typescript"), vue: enableVue = VuePackages.some((i) => (0, local_pkg.isPackageExists)(i)), tailwindcss: enableTailwind = (0, local_pkg.isPackageExists)("tailwindcss"), reactnative: enableReactNative = (0, local_pkg.isPackageExists)("react-native") } = options;
70
- const configs = [];
71
- configs.push({
72
- name: "wongxy/common",
73
- rules: resolveRules(options.rules ?? {}, {
74
- "no-console": "off",
75
- "no-alert": "off",
76
- "no-multiple-empty-lines": "warn",
77
- "antfu/top-level-function": "off",
78
- "antfu/if-newline": "off",
79
- "style/brace-style": [
80
- "error",
81
- "1tbs",
82
- { allowSingleLine: true }
83
- ],
84
- "perfectionist/sort-jsx-props": ["warn", {
85
- order: "asc",
86
- type: "natural",
87
- groups: [
88
- "reserved-first",
89
- "reserved-second",
90
- "unknown",
91
- "reserved-last"
92
- ],
93
- customGroups: [
94
- {
95
- groupName: "reserved-first",
96
- elementNamePattern: ["key", "ref"]
97
- },
98
- {
99
- groupName: "reserved-second",
100
- elementNamePattern: ["id", "name"]
101
- },
102
- {
103
- groupName: "reserved-last",
104
- elementNamePattern: ["asChild"]
105
- }
106
- ]
107
- }]
108
- })
109
- });
110
- if (enableVue) configs.push({
111
- name: "wongxy/vue",
112
- files: [_antfu_eslint_config.GLOB_VUE],
113
- rules: resolveRules((0, _antfu_eslint_config.getOverrides)(options, "vue"), {
114
- "vue/singleline-html-element-content-newline": "off",
115
- "vue/valid-template-root": "off",
116
- "vue/block-order": ["warn", { order: [["script", "template"], "style"] }],
117
- "vue/custom-event-name-casing": "off"
118
- })
119
- });
120
- if (enableReact) configs.push({
121
- name: "wongxy/react",
122
- files: [_antfu_eslint_config.GLOB_SRC],
123
- rules: resolveRules((0, _antfu_eslint_config.getOverrides)(options, "react"), { "react/prefer-destructuring-assignment": "off" })
124
- });
125
- if (enableTypeScript) configs.push({
126
- name: "wongxy/typescript",
127
- files: [_antfu_eslint_config.GLOB_TS, _antfu_eslint_config.GLOB_TSX],
128
- rules: resolveRules((0, _antfu_eslint_config.getOverrides)(options, "typescript"), { "ts/consistent-type-imports": ["error", {
129
- disallowTypeAnnotations: false,
130
- fixStyle: "inline-type-imports",
131
- prefer: "type-imports"
132
- }] })
133
- });
134
- if (enableReactNative) configs.push({
135
- name: "wongxy/reactnative",
136
- files: [_antfu_eslint_config.GLOB_TS, _antfu_eslint_config.GLOB_TSX],
137
- rules: resolveRules((0, _antfu_eslint_config.getOverrides)(options, "typescript"), {
138
- "ts/no-require-imports": "off",
139
- "ts/no-use-before-define": "off"
140
- })
141
- });
142
- if (enableTailwind) {
143
- const tw = typeof options.tailwindcss === "object" ? options.tailwindcss : void 0;
144
- configs.push(tailwindcss(tw));
145
- }
146
- return (0, _antfu_eslint_config.antfu)(options, ...configs, ...userConfigs);
147
- }
148
- //#endregion
149
- module.exports = wongxy;