@maz-ui/eslint-config 4.3.1-beta.0 → 4.3.2-beta.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.
Files changed (2) hide show
  1. package/dist/index.mjs +12 -1
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } 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,13 @@ const defaultOptions = {
124
126
  ignores: GLOBAL_IGNORES,
125
127
  rules: {}
126
128
  };
129
+ function getPackageJson() {
130
+ try {
131
+ return JSON.parse(readFileSync(join(process.cwd(), "package.json"), "utf-8"));
132
+ } catch {
133
+ return void 0;
134
+ }
135
+ }
127
136
  function defineConfig(options = {}, ...userConfigs) {
128
137
  const opts = { ...defaultOptions, ...options, ignores: [...GLOBAL_IGNORES, ...options.ignores || []] };
129
138
  const env = opts.env || process.env.NODE_ENV || "production";
@@ -131,7 +140,9 @@ function defineConfig(options = {}, ...userConfigs) {
131
140
  ...baseRules(env === "production"),
132
141
  ...opts.rules
133
142
  };
134
- if (opts.vue || opts.formatters) {
143
+ const packageJson = getPackageJson();
144
+ const vueDetected = packageJson?.dependencies?.vue || packageJson?.devDependencies?.vue;
145
+ if (opts.vue || vueDetected) {
135
146
  allRules = {
136
147
  ...allRules,
137
148
  ...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.1-beta.0",
4
+ "version": "4.3.2-beta.0",
5
5
  "description": "ESLint configuration for JavaScript/TypeScript projects",
6
6
  "author": "Louis Mazel <me@loicmazuel.com>",
7
7
  "license": "MIT",