@maz-ui/eslint-config 4.3.0-rc.0 → 4.3.1-alpha.2

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.
Files changed (2) hide show
  1. package/dist/index.mjs +11 -1
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
1
3
  import antfu from '@antfu/eslint-config';
2
4
  import sonarjs from 'eslint-plugin-sonarjs';
3
5
  import tailwind from 'eslint-plugin-tailwindcss';
@@ -124,6 +126,14 @@ const defaultOptions = {
124
126
  ignores: GLOBAL_IGNORES,
125
127
  rules: {}
126
128
  };
129
+ function getPackageJson() {
130
+ const packageJsonPath = resolve(process.cwd(), "package.json");
131
+ return JSON.parse(readFileSync(packageJsonPath, "utf-8"));
132
+ }
133
+ function hasVueDependency() {
134
+ const packageJson = getPackageJson();
135
+ return packageJson.dependencies?.vue || packageJson.dependencies?.["@vue/*"] || packageJson.devDependencies?.vue || packageJson.devDependencies?.["@vue/*"] || packageJson.optionalDependencies?.vue || packageJson.optionalDependencies?.["@vue/*"];
136
+ }
127
137
  function defineConfig(options = {}, ...userConfigs) {
128
138
  const opts = { ...defaultOptions, ...options, ignores: [...GLOBAL_IGNORES, ...options.ignores || []] };
129
139
  const env = opts.env || process.env.NODE_ENV || "production";
@@ -131,7 +141,7 @@ function defineConfig(options = {}, ...userConfigs) {
131
141
  ...baseRules(env === "production"),
132
142
  ...opts.rules
133
143
  };
134
- if (opts.vue || opts.formatters) {
144
+ if (opts.vue || opts.vueAccessibility || hasVueDependency()) {
135
145
  allRules = {
136
146
  ...allRules,
137
147
  ...vueRules
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maz-ui/eslint-config",
3
3
  "type": "module",
4
- "version": "4.3.0-rc.0",
4
+ "version": "4.3.1-alpha.2",
5
5
  "description": "ESLint configuration for JavaScript/TypeScript projects",
6
6
  "author": "Louis Mazel <me@loicmazuel.com>",
7
7
  "license": "MIT",