Skip to content

Commit ac4cb6e

Browse files
committed
Fix: lint errors
1 parent ecf6b11 commit ac4cb6e

13 files changed

+31
-31
lines changed

lib/rules/no-hide-core-modules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const CORE_MODULES = new Set([
4545
"vm",
4646
"zlib",
4747
])
48-
const BACK_SLASH = /\\/g
48+
const BACK_SLASH = /\\/gu
4949

5050
module.exports = {
5151
meta: {

lib/rules/no-unpublished-bin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = {
6868
// Convert by convertPath option
6969
const basedir = path.dirname(p.filePath)
7070
const relativePath = getConvertPath(context)(
71-
path.relative(basedir, rawFilePath).replace(/\\/g, "/")
71+
path.relative(basedir, rawFilePath).replace(/\\/gu, "/")
7272
)
7373
const filePath = path.join(basedir, relativePath)
7474

lib/rules/no-unsupported-features.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ const VERSION_SCHEMA = {
3232
],
3333
}
3434
const DEFAULT_VERSION = "4.0.0"
35-
const FUNC_TYPE = /^(?:Arrow)?Function(?:Declaration|Expression)$/
36-
const CLASS_TYPE = /^Class(?:Declaration|Expression)$/
37-
const DESTRUCTURING_PARENT_TYPE = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression|AssignmentExpression|VariableDeclarator)$/
38-
const TOPLEVEL_SCOPE_TYPE = /^(?:global|function|module)$/
39-
const BINARY_NUMBER = /^0[bB]/
40-
const OCTAL_NUMBER = /^0[oO]/
41-
const UNICODE_ESC = /(\\+)u\{[0-9a-fA-F]+?\}/g
42-
const GET_OR_SET = /^(?:g|s)et$/
35+
const FUNC_TYPE = /^(?:Arrow)?Function(?:Declaration|Expression)$/u
36+
const CLASS_TYPE = /^Class(?:Declaration|Expression)$/u
37+
const DESTRUCTURING_PARENT_TYPE = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression|AssignmentExpression|VariableDeclarator)$/u
38+
const TOPLEVEL_SCOPE_TYPE = /^(?:global|function|module)$/u
39+
const BINARY_NUMBER = /^0[bB]/u
40+
const OCTAL_NUMBER = /^0[oO]/u
41+
const UNICODE_ESC = /(\\+)u\{[0-9a-fA-F]+?\}/gu
42+
const GET_OR_SET = /^(?:g|s)et$/u
4343
const NEW_BUILTIN_TYPES = [
4444
"Int8Array",
4545
"Uint8Array",
@@ -141,9 +141,9 @@ const PROPERTY_TEST_TARGETS = {
141141
"xor",
142142
],
143143
}
144-
const REGEXP_NAMED_GROUP = /(\\*)\(\?<[_$\w]/
145-
const REGEXP_LOOKBEHIND = /(\\*)\(\?<[=!]/
146-
const REGEXP_UNICODE_PROPERTY = /(\\*)\\[pP]{.+?}/
144+
const REGEXP_NAMED_GROUP = /(\\*)\(\?<[_$\w]/u
145+
const REGEXP_LOOKBEHIND = /(\\*)\(\?<[=!]/u
146+
const REGEXP_UNICODE_PROPERTY = /(\\*)\\[pP]\{.+?\}/u
147147
const FEATURES = {
148148
defaultParameters: {
149149
alias: ["syntax"],

lib/rules/no-unsupported-features/es-syntax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const { Range } = require("semver") //eslint-disable-line no-unused-vars
1010
const getConfiguredNodeVersion = require("../../util/get-configured-node-version")
1111
const getSemverRange = require("../../util/get-semver-range")
1212

13-
const getOrSet = /^(?:g|s)et$/
13+
const getOrSet = /^(?:g|s)et$/u
1414
const features = {
1515
//--------------------------------------------------------------------------
1616
// ES2015

lib/rules/shebang.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ const getConvertPath = require("../util/get-convert-path")
99
const getPackageJson = require("../util/get-package-json")
1010

1111
const NODE_SHEBANG = "#!/usr/bin/env node\n"
12-
const SHEBANG_PATTERN = /^(#!.+?)?(\r)?\n/
13-
const NODE_SHEBANG_PATTERN = /#!\/usr\/bin\/env node(?: [^\r\n]+?)?\n/
12+
const SHEBANG_PATTERN = /^(#!.+?)?(\r)?\n/u
13+
const NODE_SHEBANG_PATTERN = /#!\/usr\/bin\/env node(?: [^\r\n]+?)?\n/u
1414

1515
/**
1616
* Checks whether or not a given path is a `bin` file.
@@ -89,7 +89,7 @@ module.exports = {
8989
filePath = path.join(
9090
basedir,
9191
getConvertPath(context)(
92-
path.relative(basedir, filePath).replace(/\\/g, "/")
92+
path.relative(basedir, filePath).replace(/\\/gu, "/")
9393
)
9494
)
9595

lib/util/check-publish.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = function checkForPublish(context, filePath, targets) {
3131
const basedir = path.dirname(packageInfo.filePath)
3232
// eslint-disable-next-line func-style, require-jsdoc
3333
const toRelative = fullPath => {
34-
const retv = path.relative(basedir, fullPath).replace(/\\/g, "/")
34+
const retv = path.relative(basedir, fullPath).replace(/\\/gu, "/")
3535
return convertPath(retv)
3636
}
3737
const npmignore = getNpmignore(filePath)

lib/util/exists.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const fs = require("fs")
88
const path = require("path")
99
const Cache = require("./cache")
1010

11-
const ROOT = /^(?:[/.]|\.\.|[A-Z]:\\|\\\\)(?:[/\\]\.\.)*$/
11+
const ROOT = /^(?:[/.]|\.\.|[A-Z]:\\|\\\\)(?:[/\\]\.\.)*$/u
1212
const cache = new Cache()
1313

1414
/**

lib/util/get-convert-path.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function parse(option) {
109109
for (const pattern of normalizeValue(option.convertPath)) {
110110
const include = toStringArray(pattern.include)
111111
const exclude = toStringArray(pattern.exclude)
112-
const fromRegexp = new RegExp(String(pattern.replace[0]))
112+
const fromRegexp = new RegExp(String(pattern.replace[0])) //eslint-disable-line require-unicode-regexp
113113
const toStr = String(pattern.replace[1])
114114

115115
converters.push({

lib/util/get-import-export-targets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const getTryExtensions = require("./get-try-extensions")
1111
const ImportTarget = require("./import-target")
1212
const stripImportPathParams = require("./strip-import-path-params")
1313

14-
const MODULE_TYPE = /^(?:Import|Export(?:Named|Default|All))Declaration$/
14+
const MODULE_TYPE = /^(?:Import|Export(?:Named|Default|All))Declaration$/u
1515

1616
/**
1717
* Gets a list of `import`/`export` declaration targets.

lib/util/get-npmignore.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ const exists = require("./exists")
1212
const getPackageJson = require("./get-package-json")
1313

1414
const cache = new Cache()
15-
const SLASH_AT_BEGIN_AND_END = /^!?\/+|^!|\/+$/g
16-
const PARENT_RELATIVE_PATH = /^\.\./
17-
const NEVER_IGNORED = /^(?:readme\.[^.]*|(?:licen[cs]e|changes|changelog|history)(?:\.[^.]*)?)$/i
15+
const SLASH_AT_BEGIN_AND_END = /^!?\/+|^!|\/+$/gu
16+
const PARENT_RELATIVE_PATH = /^\.\./u
17+
const NEVER_IGNORED = /^(?:readme\.[^.]*|(?:licen[cs]e|changes|changelog|history)(?:\.[^.]*)?)$/iu
1818

1919
/**
2020
* Checks whether or not a given file name is a relative path to a ancestor

0 commit comments

Comments
 (0)