@jsenv/eslint-config-relax 1.7.4 → 1.7.7

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/eslint-config-relax",
3
- "version": "1.7.4",
3
+ "version": "1.7.7",
4
4
  "description": "A pleaseant ESLint configuration for any project",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,15 +24,15 @@
24
24
  ],
25
25
  "scripts": {},
26
26
  "dependencies": {
27
- "@babel/eslint-parser": "7.28.4",
27
+ "@babel/eslint-parser": "7.28.5",
28
28
  "@jsenv/eslint-import-resolver": "8.4.2",
29
- "@jsenv/eslint-plugin": "1.0.0",
30
- "@jsenv/urls": "2.9.2",
29
+ "@jsenv/eslint-plugin": "1.1.0",
30
+ "@jsenv/urls": "2.9.3",
31
31
  "eslint-plugin-html": "8.1.3",
32
32
  "eslint-plugin-import-x": "4.16.1",
33
33
  "eslint-plugin-react": "7.37.5",
34
34
  "eslint-plugin-regexp": "2.10.0",
35
- "globals": "16.4.0"
35
+ "globals": "16.5.0"
36
36
  },
37
37
  "devDependencies": {},
38
38
  "engines": {
@@ -1,3 +1,6 @@
1
+ // TODO: ideally when any dev package condition result in a file not found we should
2
+ // warn and fallback to other conditions
3
+
1
4
  import babelParser from "@babel/eslint-parser";
2
5
  import jsenvPlugin from "@jsenv/eslint-plugin";
3
6
  import { urlToRelativeUrl } from "@jsenv/urls";
@@ -73,19 +76,28 @@ export const eslintConfigRelax = ({
73
76
  }
74
77
 
75
78
  const browserExtensions = [".js", ".jsx"];
76
- browserFiles = [
79
+ const defaultBrowserFiles = [
77
80
  "**/*.html",
78
81
  ...patternForEachExtension("**/client/**/*[extension]", browserExtensions),
79
82
  ...patternForEachExtension("**/www/**/*[extension]", browserExtensions),
80
83
  ...patternForEachExtension("**/browser/**/*[extension]", browserExtensions),
81
- ...(browserDirectoryUrl
82
- ? patternForEachExtension(
83
- `${urlToRelativeUrl(browserDirectoryUrl, rootDirectoryUrl)}/**/*[extension]`,
84
- browserExtensions,
85
- )
86
- : []),
87
- ...browserFiles,
88
84
  ];
85
+ if (browserDirectoryUrl) {
86
+ let relativeBrowserDir = urlToRelativeUrl(
87
+ browserDirectoryUrl,
88
+ rootDirectoryUrl,
89
+ );
90
+ if (relativeBrowserDir.endsWith("/")) {
91
+ relativeBrowserDir = relativeBrowserDir.slice(0, -1);
92
+ }
93
+ defaultBrowserFiles.push(
94
+ ...patternForEachExtension(
95
+ `${relativeBrowserDir}/**/*[extension]`,
96
+ browserExtensions,
97
+ ),
98
+ );
99
+ }
100
+ browserFiles = [...defaultBrowserFiles, ...browserFiles];
89
101
  browserAndNodeFiles = [...browserAndNodeFiles];
90
102
  const parserOptions = {
91
103
  ecmaVersion: 2022,
@@ -314,6 +326,17 @@ export const eslintConfigRelax = ({
314
326
  {
315
327
  files: ["**/*.html"],
316
328
  plugins: { html },
329
+ rules: {
330
+ // Ignore JSX components (start with uppercase)
331
+ // https://github.com/BenoitZugmeyer/eslint-plugin-html/issues/295
332
+ "no-unused-vars": [
333
+ rulesRelax["no-unused-vars"][0],
334
+ {
335
+ ...rulesRelax["no-unused-vars"][1],
336
+ varsIgnorePattern: "^[A-Z]",
337
+ },
338
+ ],
339
+ },
317
340
  settings: {
318
341
  "html/javascript-mime-types": [
319
342
  "text/javascript",