@luxass/eslint-config 4.2.7 → 4.2.9

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/dist/index.cjs CHANGED
@@ -93,7 +93,7 @@ module.exports = __toCommonJS(src_exports);
93
93
  // src/factory.ts
94
94
  var import_node_process3 = __toESM(require("process"), 1);
95
95
  var import_node_fs = require("fs");
96
- var import_local_pkg3 = require("local-pkg");
96
+ var import_local_pkg4 = require("local-pkg");
97
97
 
98
98
  // src/configs/comments.ts
99
99
  var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
@@ -830,25 +830,21 @@ async function ensure(packages) {
830
830
  return;
831
831
  }
832
832
  ;
833
- const nonExistingPackages = packages.filter((i) => !(0, import_local_pkg.isPackageExists)(i));
833
+ const nonExistingPackages = packages.filter((i) => i && !(0, import_local_pkg.isPackageExists)(i));
834
834
  if (nonExistingPackages.length === 0) {
835
835
  return;
836
836
  }
837
- ;
838
837
  const { default: prompts } = await import("prompts");
839
838
  const { result } = await prompts([
840
839
  {
841
- name: "result",
842
840
  message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
841
+ name: "result",
843
842
  type: "confirm"
844
843
  }
845
844
  ]);
846
845
  if (result) {
847
- await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, {
848
- dev: true
849
- }));
846
+ await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
850
847
  }
851
- ;
852
848
  }
853
849
  function resolveSubOptions(options, key) {
854
850
  return typeof options[key] === "boolean" ? {} : options[key] || {};
@@ -1349,6 +1345,26 @@ async function vue(options = {}) {
1349
1345
  return [
1350
1346
  {
1351
1347
  name: "luxass:vue:setup",
1348
+ // This allows Vue plugin to work with auto imports
1349
+ // https://github.com/vuejs/eslint-plugin-vue/pull/2422
1350
+ languageOptions: {
1351
+ globals: {
1352
+ computed: "readonly",
1353
+ defineEmits: "readonly",
1354
+ defineExpose: "readonly",
1355
+ defineProps: "readonly",
1356
+ onMounted: "readonly",
1357
+ onUnmounted: "readonly",
1358
+ reactive: "readonly",
1359
+ ref: "readonly",
1360
+ shallowReactive: "readonly",
1361
+ shallowRef: "readonly",
1362
+ toRef: "readonly",
1363
+ toRefs: "readonly",
1364
+ watch: "readonly",
1365
+ watchEffect: "readonly"
1366
+ }
1367
+ },
1352
1368
  plugins: {
1353
1369
  vue: pluginVue
1354
1370
  }
@@ -2003,29 +2019,29 @@ async function react(options = {}) {
2003
2019
  // src/configs/frameworks/astro.ts
2004
2020
  async function astro(options) {
2005
2021
  const {
2006
- a11y = false,
2007
2022
  files = [GLOB_ASTRO],
2008
2023
  overrides = {},
2009
2024
  typescript: typescript2 = true,
2010
2025
  stylistic: stylistic2 = true
2011
2026
  } = options;
2027
+ await ensure([
2028
+ "eslint-plugin-astro",
2029
+ "astro-eslint-parser"
2030
+ ]);
2012
2031
  const [
2013
2032
  pluginAstro,
2014
2033
  parserAstro,
2015
- parserTs,
2016
- pluginA11y
2034
+ parserTs
2017
2035
  ] = await Promise.all([
2018
2036
  interop(import("eslint-plugin-astro")),
2019
2037
  interop(import("astro-eslint-parser")),
2020
- interop(import("@typescript-eslint/parser")),
2021
- ...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
2038
+ interop(import("@typescript-eslint/parser"))
2022
2039
  ]);
2023
2040
  return [
2024
2041
  {
2025
2042
  name: "luxass:astro:setup",
2026
2043
  plugins: {
2027
- astro: pluginAstro,
2028
- ...a11y ? { "jsx-a11y": pluginA11y } : {}
2044
+ astro: pluginAstro
2029
2045
  }
2030
2046
  },
2031
2047
  {
@@ -2147,18 +2163,21 @@ async function tailwindcss(options = {}) {
2147
2163
 
2148
2164
  // src/configs/formatters.ts
2149
2165
  var parserPlain2 = __toESM(require("eslint-parser-plain"), 1);
2166
+ var import_local_pkg3 = require("local-pkg");
2150
2167
  async function formatters(options = {}, stylistic2 = {}) {
2151
- await ensure([
2152
- "eslint-plugin-format"
2153
- ]);
2154
2168
  if (options === true) {
2155
2169
  options = {
2170
+ astro: (0, import_local_pkg3.isPackageExists)("astro"),
2156
2171
  css: true,
2157
2172
  graphql: true,
2158
2173
  html: true,
2159
2174
  markdown: true
2160
2175
  };
2161
2176
  }
2177
+ await ensure([
2178
+ "eslint-plugin-format",
2179
+ options.astro ? "prettier-plugin-astro" : void 0
2180
+ ]);
2162
2181
  const {
2163
2182
  indent,
2164
2183
  quotes,
@@ -2289,6 +2308,27 @@ async function formatters(options = {}, stylistic2 = {}) {
2289
2308
  }
2290
2309
  });
2291
2310
  }
2311
+ if (options.astro) {
2312
+ configs.push({
2313
+ name: "luxass:formatter:astro",
2314
+ files: [GLOB_ASTRO],
2315
+ languageOptions: {
2316
+ parser: parserPlain2
2317
+ },
2318
+ rules: {
2319
+ "format/prettier": [
2320
+ "error",
2321
+ {
2322
+ ...prettierOptions,
2323
+ parser: "astro",
2324
+ plugins: [
2325
+ "prettier-plugin-astro"
2326
+ ]
2327
+ }
2328
+ ]
2329
+ }
2330
+ });
2331
+ }
2292
2332
  if (options.graphql) {
2293
2333
  configs.push({
2294
2334
  name: "luxass:formatter:graphql",
@@ -2396,9 +2436,9 @@ async function luxass(options = {}, ...userConfigs) {
2396
2436
  nextjs: enableNextJS = false,
2397
2437
  react: enableReact = false,
2398
2438
  tailwindcss: enableTailwindCSS = false,
2399
- typescript: enableTypeScript = (0, import_local_pkg3.isPackageExists)("typescript"),
2439
+ typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
2400
2440
  unocss: enableUnoCSS = false,
2401
- vue: enableVue = VuePackages.some((i) => (0, import_local_pkg3.isPackageExists)(i))
2441
+ vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
2402
2442
  } = options;
2403
2443
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2404
2444
  if (stylisticOptions && !("jsx" in stylisticOptions)) {
package/dist/index.d.cts CHANGED
@@ -324,12 +324,6 @@ interface AstroOptions {
324
324
  * @default true
325
325
  */
326
326
  typescript?: boolean;
327
- /**
328
- * Enable React A11y support.
329
- *
330
- * @default false
331
- */
332
- a11y?: boolean;
333
327
  /**
334
328
  * Glob patterns for Astro files.
335
329
  *
@@ -481,6 +475,12 @@ interface FormattersOptions {
481
475
  * When set to `true`, it will use Prettier.
482
476
  */
483
477
  markdown?: "prettier" | "dprint" | boolean;
478
+ /**
479
+ * Enable formatting support for Astro.
480
+ *
481
+ * Currently only support Prettier.
482
+ */
483
+ astro?: "prettier" | boolean;
484
484
  /**
485
485
  * Enable formatting support for GraphQL.
486
486
  */
@@ -728,7 +728,7 @@ declare function toArray<T>(value: T | T[]): T[];
728
728
  declare function interop<T>(m: Awaitable<T>): Promise<T extends {
729
729
  default: infer U;
730
730
  } ? U : T>;
731
- declare function ensure(packages: string[]): Promise<void>;
731
+ declare function ensure(packages: (string | undefined)[]): Promise<void>;
732
732
  type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
733
733
  declare function resolveSubOptions<K extends keyof ConfigOptions>(options: ConfigOptions, key: K): ResolvedOptions<ConfigOptions[K]>;
734
734
  declare function getOverrides<K extends keyof ConfigOptions>(options: ConfigOptions, key: K): any;
package/dist/index.d.ts CHANGED
@@ -324,12 +324,6 @@ interface AstroOptions {
324
324
  * @default true
325
325
  */
326
326
  typescript?: boolean;
327
- /**
328
- * Enable React A11y support.
329
- *
330
- * @default false
331
- */
332
- a11y?: boolean;
333
327
  /**
334
328
  * Glob patterns for Astro files.
335
329
  *
@@ -481,6 +475,12 @@ interface FormattersOptions {
481
475
  * When set to `true`, it will use Prettier.
482
476
  */
483
477
  markdown?: "prettier" | "dprint" | boolean;
478
+ /**
479
+ * Enable formatting support for Astro.
480
+ *
481
+ * Currently only support Prettier.
482
+ */
483
+ astro?: "prettier" | boolean;
484
484
  /**
485
485
  * Enable formatting support for GraphQL.
486
486
  */
@@ -728,7 +728,7 @@ declare function toArray<T>(value: T | T[]): T[];
728
728
  declare function interop<T>(m: Awaitable<T>): Promise<T extends {
729
729
  default: infer U;
730
730
  } ? U : T>;
731
- declare function ensure(packages: string[]): Promise<void>;
731
+ declare function ensure(packages: (string | undefined)[]): Promise<void>;
732
732
  type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
733
733
  declare function resolveSubOptions<K extends keyof ConfigOptions>(options: ConfigOptions, key: K): ResolvedOptions<ConfigOptions[K]>;
734
734
  declare function getOverrides<K extends keyof ConfigOptions>(options: ConfigOptions, key: K): any;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/factory.ts
2
2
  import process3 from "node:process";
3
3
  import { existsSync } from "node:fs";
4
- import { isPackageExists as isPackageExists3 } from "local-pkg";
4
+ import { isPackageExists as isPackageExists4 } from "local-pkg";
5
5
 
6
6
  // src/configs/comments.ts
7
7
  import eslintCommentsPlugin from "@eslint-community/eslint-plugin-eslint-comments";
@@ -738,25 +738,21 @@ async function ensure(packages) {
738
738
  return;
739
739
  }
740
740
  ;
741
- const nonExistingPackages = packages.filter((i) => !isPackageExists(i));
741
+ const nonExistingPackages = packages.filter((i) => i && !isPackageExists(i));
742
742
  if (nonExistingPackages.length === 0) {
743
743
  return;
744
744
  }
745
- ;
746
745
  const { default: prompts } = await import("prompts");
747
746
  const { result } = await prompts([
748
747
  {
749
- name: "result",
750
748
  message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
749
+ name: "result",
751
750
  type: "confirm"
752
751
  }
753
752
  ]);
754
753
  if (result) {
755
- await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, {
756
- dev: true
757
- }));
754
+ await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
758
755
  }
759
- ;
760
756
  }
761
757
  function resolveSubOptions(options, key) {
762
758
  return typeof options[key] === "boolean" ? {} : options[key] || {};
@@ -1257,6 +1253,26 @@ async function vue(options = {}) {
1257
1253
  return [
1258
1254
  {
1259
1255
  name: "luxass:vue:setup",
1256
+ // This allows Vue plugin to work with auto imports
1257
+ // https://github.com/vuejs/eslint-plugin-vue/pull/2422
1258
+ languageOptions: {
1259
+ globals: {
1260
+ computed: "readonly",
1261
+ defineEmits: "readonly",
1262
+ defineExpose: "readonly",
1263
+ defineProps: "readonly",
1264
+ onMounted: "readonly",
1265
+ onUnmounted: "readonly",
1266
+ reactive: "readonly",
1267
+ ref: "readonly",
1268
+ shallowReactive: "readonly",
1269
+ shallowRef: "readonly",
1270
+ toRef: "readonly",
1271
+ toRefs: "readonly",
1272
+ watch: "readonly",
1273
+ watchEffect: "readonly"
1274
+ }
1275
+ },
1260
1276
  plugins: {
1261
1277
  vue: pluginVue
1262
1278
  }
@@ -1911,29 +1927,29 @@ async function react(options = {}) {
1911
1927
  // src/configs/frameworks/astro.ts
1912
1928
  async function astro(options) {
1913
1929
  const {
1914
- a11y = false,
1915
1930
  files = [GLOB_ASTRO],
1916
1931
  overrides = {},
1917
1932
  typescript: typescript2 = true,
1918
1933
  stylistic: stylistic2 = true
1919
1934
  } = options;
1935
+ await ensure([
1936
+ "eslint-plugin-astro",
1937
+ "astro-eslint-parser"
1938
+ ]);
1920
1939
  const [
1921
1940
  pluginAstro,
1922
1941
  parserAstro,
1923
- parserTs,
1924
- pluginA11y
1942
+ parserTs
1925
1943
  ] = await Promise.all([
1926
1944
  interop(import("eslint-plugin-astro")),
1927
1945
  interop(import("astro-eslint-parser")),
1928
- interop(import("@typescript-eslint/parser")),
1929
- ...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
1946
+ interop(import("@typescript-eslint/parser"))
1930
1947
  ]);
1931
1948
  return [
1932
1949
  {
1933
1950
  name: "luxass:astro:setup",
1934
1951
  plugins: {
1935
- astro: pluginAstro,
1936
- ...a11y ? { "jsx-a11y": pluginA11y } : {}
1952
+ astro: pluginAstro
1937
1953
  }
1938
1954
  },
1939
1955
  {
@@ -2055,18 +2071,21 @@ async function tailwindcss(options = {}) {
2055
2071
 
2056
2072
  // src/configs/formatters.ts
2057
2073
  import * as parserPlain2 from "eslint-parser-plain";
2074
+ import { isPackageExists as isPackageExists3 } from "local-pkg";
2058
2075
  async function formatters(options = {}, stylistic2 = {}) {
2059
- await ensure([
2060
- "eslint-plugin-format"
2061
- ]);
2062
2076
  if (options === true) {
2063
2077
  options = {
2078
+ astro: isPackageExists3("astro"),
2064
2079
  css: true,
2065
2080
  graphql: true,
2066
2081
  html: true,
2067
2082
  markdown: true
2068
2083
  };
2069
2084
  }
2085
+ await ensure([
2086
+ "eslint-plugin-format",
2087
+ options.astro ? "prettier-plugin-astro" : void 0
2088
+ ]);
2070
2089
  const {
2071
2090
  indent,
2072
2091
  quotes,
@@ -2197,6 +2216,27 @@ async function formatters(options = {}, stylistic2 = {}) {
2197
2216
  }
2198
2217
  });
2199
2218
  }
2219
+ if (options.astro) {
2220
+ configs.push({
2221
+ name: "luxass:formatter:astro",
2222
+ files: [GLOB_ASTRO],
2223
+ languageOptions: {
2224
+ parser: parserPlain2
2225
+ },
2226
+ rules: {
2227
+ "format/prettier": [
2228
+ "error",
2229
+ {
2230
+ ...prettierOptions,
2231
+ parser: "astro",
2232
+ plugins: [
2233
+ "prettier-plugin-astro"
2234
+ ]
2235
+ }
2236
+ ]
2237
+ }
2238
+ });
2239
+ }
2200
2240
  if (options.graphql) {
2201
2241
  configs.push({
2202
2242
  name: "luxass:formatter:graphql",
@@ -2304,9 +2344,9 @@ async function luxass(options = {}, ...userConfigs) {
2304
2344
  nextjs: enableNextJS = false,
2305
2345
  react: enableReact = false,
2306
2346
  tailwindcss: enableTailwindCSS = false,
2307
- typescript: enableTypeScript = isPackageExists3("typescript"),
2347
+ typescript: enableTypeScript = isPackageExists4("typescript"),
2308
2348
  unocss: enableUnoCSS = false,
2309
- vue: enableVue = VuePackages.some((i) => isPackageExists3(i))
2349
+ vue: enableVue = VuePackages.some((i) => isPackageExists4(i))
2310
2350
  } = options;
2311
2351
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2312
2352
  if (stylisticOptions && !("jsx" in stylisticOptions)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxass/eslint-config",
3
- "version": "4.2.7",
3
+ "version": "4.2.9",
4
4
  "description": "ESLint config for @luxass",
5
5
  "type": "module",
6
6
  "author": {
@@ -97,8 +97,8 @@
97
97
  "@eslint-types/typescript-eslint": "^7.0.2",
98
98
  "@eslint-types/unicorn": "^51.0.1",
99
99
  "@stylistic/eslint-plugin": "^1.6.3",
100
- "@typescript-eslint/eslint-plugin": "^7.1.1",
101
- "@typescript-eslint/parser": "^7.1.1",
100
+ "@typescript-eslint/eslint-plugin": "^7.2.0",
101
+ "@typescript-eslint/parser": "^7.2.0",
102
102
  "eslint-config-flat-gitignore": "^0.1.3",
103
103
  "eslint-merge-processors": "^0.1.0",
104
104
  "eslint-parser-plain": "^0.1.0",
@@ -113,8 +113,8 @@
113
113
  "eslint-plugin-toml": "^0.9.2",
114
114
  "eslint-plugin-unicorn": "^51.0.1",
115
115
  "eslint-plugin-unused-imports": "^3.1.0",
116
- "eslint-plugin-vitest": "^0.3.24",
117
- "eslint-plugin-vue": "^9.22.0",
116
+ "eslint-plugin-vitest": "^0.3.26",
117
+ "eslint-plugin-vue": "^9.23.0",
118
118
  "eslint-plugin-yml": "^1.12.2",
119
119
  "eslint-processor-vue-blocks": "^0.1.1",
120
120
  "globals": "^14.0.0",
@@ -134,7 +134,7 @@
134
134
  "@types/estree": "^1.0.5",
135
135
  "@types/node": "^18.17.19",
136
136
  "@types/prompts": "^2.4.9",
137
- "@typescript-eslint/rule-tester": "^7.1.1",
137
+ "@typescript-eslint/rule-tester": "^7.2.0",
138
138
  "@unocss/eslint-plugin": "^0.58.5",
139
139
  "astro-eslint-parser": "^0.16.3",
140
140
  "eslint": "^8.57.0",
@@ -143,7 +143,7 @@
143
143
  "eslint-plugin-react": "^7.34.0",
144
144
  "eslint-plugin-react-hooks": "^4.6.0",
145
145
  "eslint-plugin-react-refresh": "^0.4.5",
146
- "eslint-plugin-tailwindcss": "^3.14.3",
146
+ "eslint-plugin-tailwindcss": "^3.15.1",
147
147
  "lint-staged": "^15.2.2",
148
148
  "prettier-plugin-astro": "^0.13.0",
149
149
  "simple-git-hooks": "^2.10.0",