eslint-plugin-chrome-extensions 2.3.0 → 2.4.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.
@@ -30,14 +30,16 @@ export default {
30
30
  },
31
31
  timezone: {
32
32
  type: 'string',
33
- description: 'IANA timezone for determining the current date (when omitted, only year and month are checked)'
33
+ description: 'IANA timezone for determining the current date '
34
+ + '(when omitted, only year and month are checked)'
34
35
  }
35
36
  },
36
37
  additionalProperties: false
37
38
  }],
38
39
  defaultOptions: [{}],
39
40
  messages: {
40
- invalidVersion: 'Invalid manifest `version`: must be a valid {{versionType}} version (expected format: {{example}}).',
41
+ invalidVersion: 'Invalid manifest `version`: must be a valid {{versionType}} version '
42
+ + '(expected format: {{example}}).',
41
43
  futureVersion: 'Invalid manifest `version`: date cannot be in the future.'
42
44
  }
43
45
  },
package/src/utils.js CHANGED
@@ -10,17 +10,6 @@ export function bundleRules(rules, predicate, pluginName) {
10
10
  .map(([ruleId]) => [`${pluginName}/${ruleId}`, 'error']))
11
11
  }
12
12
 
13
- export function initBundleDeprecation(plugin, [ruleId, bundleNames], pluginName) {
14
- for (const bundleName of bundleNames) {
15
- /* eslint-disable security/detect-object-injection */
16
- if (plugin.configs[bundleName])
17
- plugin.configs[bundleName].rules[`${pluginName}/${ruleId}`] = 'error'
18
- /* eslint-enable security/detect-object-injection */
19
- if (process.env.DEBUG_MODE)
20
- console.warn(`[${pluginName}] '${ruleId}' will be removed from '${bundleName}' in a future major release`)
21
- }
22
- }
23
-
24
13
  export function findExtensionRoot(context) {
25
14
  let dir = path.dirname(getFilename(context))
26
15
  while (dir) {
@@ -55,6 +44,17 @@ export function getMemberPath(node) {
55
44
  return parts.join('.')
56
45
  }
57
46
 
47
+ export function initBundleDeprecation(plugin, [ruleId, bundleNames], pluginName) {
48
+ for (const bundleName of bundleNames) {
49
+ /* eslint-disable security/detect-object-injection */
50
+ if (plugin.configs[bundleName])
51
+ plugin.configs[bundleName].rules[`${pluginName}/${ruleId}`] = 'error'
52
+ /* eslint-enable security/detect-object-injection */
53
+ if (process.env.DEBUG_MODE)
54
+ console.warn(`[${pluginName}] '${ruleId}' will be removed from '${bundleName}' in a future major release`)
55
+ }
56
+ }
57
+
58
58
  export function isContentScriptFile(context, manifest) {
59
59
  const scripts = (manifest?.content_scripts || []).flatMap(cs => cs.js || [])
60
60
  if (!scripts.length) return false
@@ -87,8 +87,7 @@ export function readManifest(context) {
87
87
  if (!root) return null
88
88
  if (manifestCache.has(root)) return manifestCache.get(root)
89
89
  let parsed
90
- try {
91
- // eslint-disable-next-line security/detect-non-literal-fs-filename
90
+ try { // eslint-disable-next-line security/detect-non-literal-fs-filename
92
91
  parsed = JSON.parse(fs.readFileSync(path.join(root, 'manifest.json'), 'utf8'))
93
92
  } catch { parsed = null }
94
93
  manifestCache.set(root, parsed)