eslint-plugin-chrome-extensions 2.11.0 → 2.11.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/README.md CHANGED
@@ -33,7 +33,7 @@ npm i -D eslint-plugin-chrome-extensions
33
33
  Usage
34
34
  </h2>
35
35
 
36
- ### <img height=15 width=auto src="https://www.google.com/s2/favicons?domain=eslint.org&sz=64"> ESLint
36
+ ### <img width=15 src="https://www.google.com/s2/favicons?domain=eslint.org&sz=64"> ESLint
37
37
 
38
38
  Add bundled configs to your `eslint.config.*js` for each file type you need:
39
39
 
@@ -65,7 +65,7 @@ export default [
65
65
 
66
66
  ---
67
67
 
68
- ### <img height=15 width=auto src="https://www.google.com/s2/favicons?domain=oxc.rs&sz=64"> Oxlint
68
+ ### <img width=15 src="https://www.google.com/s2/favicons?domain=oxc.rs&sz=64"> Oxlint
69
69
 
70
70
  Add a JS/TS bundle to your `oxlint.config.*ts` (non-JS/TS parsing is unsupported by Oxlint):
71
71
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-chrome-extensions",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "description": "ESLint rules for Chrome extensions",
5
5
  "keywords": [
6
6
  "eslint",
package/src/utils/pkg.js CHANGED
@@ -2,6 +2,19 @@ import { fileURLToPath } from 'node:url'
2
2
  import fs from 'node:fs'
3
3
  import path from 'node:path'
4
4
 
5
+ const pkg = (() => {
6
+ let current = path.dirname(fileURLToPath(import.meta.url))
7
+ while (current) { // oxlint-disable security/detect-non-literal-fs-filename
8
+ const pkgPath = path.join(current, 'package.json')
9
+ if (fs.existsSync(pkgPath))
10
+ try { return JSON.parse(fs.readFileSync(pkgPath, 'utf8')) } catch {}
11
+ const parent = path.dirname(current)
12
+ if (parent === current) break
13
+ current = parent
14
+ } // oxlint-enable security/detect-non-literal-fs-filename
15
+ return null
16
+ })()
17
+
5
18
  export default {
6
19
  findRoot(dir) {
7
20
  let current = path.resolve(dir)
@@ -19,20 +32,6 @@ export default {
19
32
  current = parent
20
33
  }
21
34
  },
22
-
23
- getName() { // oxlint-disable security/detect-non-literal-fs-filename
24
- let current = path.dirname(fileURLToPath(import.meta.url))
25
- while (current) {
26
- const pkgPath = path.join(current, 'package.json')
27
- if (fs.existsSync(pkgPath))
28
- try {
29
- const { name } = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))
30
- if (name) return name
31
- } catch { /* malformed, keep walking */ }
32
- const parent = path.dirname(current)
33
- if (parent === current) return null
34
- current = parent
35
- }
36
- return null
37
- } // oxlint-enable security/detect-non-literal-fs-filename
35
+ getName() { return pkg?.name ?? null },
36
+ getVer() { return pkg?.version ?? null }
38
37
  }
package/src/utils/text.js CHANGED
@@ -1,5 +1,8 @@
1
+ import pkg from './pkg.js'
2
+
1
3
  export default {
2
4
  parser: {
5
+ meta: { name: pkg.getName(), version: pkg.getVer() },
3
6
  parse: text => ({
4
7
  type: 'Program',
5
8
  body: [],