Skip to content

Commit

Permalink
Fix: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Oct 27, 2018
1 parent ecf6b11 commit ac4cb6e
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion lib/rules/no-hide-core-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const CORE_MODULES = new Set([
"vm",
"zlib",
])
const BACK_SLASH = /\\/g
const BACK_SLASH = /\\/gu

module.exports = {
meta: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-unpublished-bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module.exports = {
// Convert by convertPath option
const basedir = path.dirname(p.filePath)
const relativePath = getConvertPath(context)(
path.relative(basedir, rawFilePath).replace(/\\/g, "/")
path.relative(basedir, rawFilePath).replace(/\\/gu, "/")
)
const filePath = path.join(basedir, relativePath)

Expand Down
22 changes: 11 additions & 11 deletions lib/rules/no-unsupported-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ const VERSION_SCHEMA = {
],
}
const DEFAULT_VERSION = "4.0.0"
const FUNC_TYPE = /^(?:Arrow)?Function(?:Declaration|Expression)$/
const CLASS_TYPE = /^Class(?:Declaration|Expression)$/
const DESTRUCTURING_PARENT_TYPE = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression|AssignmentExpression|VariableDeclarator)$/
const TOPLEVEL_SCOPE_TYPE = /^(?:global|function|module)$/
const BINARY_NUMBER = /^0[bB]/
const OCTAL_NUMBER = /^0[oO]/
const UNICODE_ESC = /(\\+)u\{[0-9a-fA-F]+?\}/g
const GET_OR_SET = /^(?:g|s)et$/
const FUNC_TYPE = /^(?:Arrow)?Function(?:Declaration|Expression)$/u
const CLASS_TYPE = /^Class(?:Declaration|Expression)$/u
const DESTRUCTURING_PARENT_TYPE = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression|AssignmentExpression|VariableDeclarator)$/u
const TOPLEVEL_SCOPE_TYPE = /^(?:global|function|module)$/u
const BINARY_NUMBER = /^0[bB]/u
const OCTAL_NUMBER = /^0[oO]/u
const UNICODE_ESC = /(\\+)u\{[0-9a-fA-F]+?\}/gu
const GET_OR_SET = /^(?:g|s)et$/u
const NEW_BUILTIN_TYPES = [
"Int8Array",
"Uint8Array",
Expand Down Expand Up @@ -141,9 +141,9 @@ const PROPERTY_TEST_TARGETS = {
"xor",
],
}
const REGEXP_NAMED_GROUP = /(\\*)\(\?<[_$\w]/
const REGEXP_LOOKBEHIND = /(\\*)\(\?<[=!]/
const REGEXP_UNICODE_PROPERTY = /(\\*)\\[pP]{.+?}/
const REGEXP_NAMED_GROUP = /(\\*)\(\?<[_$\w]/u
const REGEXP_LOOKBEHIND = /(\\*)\(\?<[=!]/u
const REGEXP_UNICODE_PROPERTY = /(\\*)\\[pP]\{.+?\}/u
const FEATURES = {
defaultParameters: {
alias: ["syntax"],
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-unsupported-features/es-syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { Range } = require("semver") //eslint-disable-line no-unused-vars
const getConfiguredNodeVersion = require("../../util/get-configured-node-version")
const getSemverRange = require("../../util/get-semver-range")

const getOrSet = /^(?:g|s)et$/
const getOrSet = /^(?:g|s)et$/u
const features = {
//--------------------------------------------------------------------------
// ES2015
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/shebang.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const getConvertPath = require("../util/get-convert-path")
const getPackageJson = require("../util/get-package-json")

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

/**
* Checks whether or not a given path is a `bin` file.
Expand Down Expand Up @@ -89,7 +89,7 @@ module.exports = {
filePath = path.join(
basedir,
getConvertPath(context)(
path.relative(basedir, filePath).replace(/\\/g, "/")
path.relative(basedir, filePath).replace(/\\/gu, "/")
)
)

Expand Down
2 changes: 1 addition & 1 deletion lib/util/check-publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = function checkForPublish(context, filePath, targets) {
const basedir = path.dirname(packageInfo.filePath)
// eslint-disable-next-line func-style, require-jsdoc
const toRelative = fullPath => {
const retv = path.relative(basedir, fullPath).replace(/\\/g, "/")
const retv = path.relative(basedir, fullPath).replace(/\\/gu, "/")
return convertPath(retv)
}
const npmignore = getNpmignore(filePath)
Expand Down
2 changes: 1 addition & 1 deletion lib/util/exists.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const fs = require("fs")
const path = require("path")
const Cache = require("./cache")

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

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/util/get-convert-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function parse(option) {
for (const pattern of normalizeValue(option.convertPath)) {
const include = toStringArray(pattern.include)
const exclude = toStringArray(pattern.exclude)
const fromRegexp = new RegExp(String(pattern.replace[0]))
const fromRegexp = new RegExp(String(pattern.replace[0])) //eslint-disable-line require-unicode-regexp
const toStr = String(pattern.replace[1])

converters.push({
Expand Down
2 changes: 1 addition & 1 deletion lib/util/get-import-export-targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const getTryExtensions = require("./get-try-extensions")
const ImportTarget = require("./import-target")
const stripImportPathParams = require("./strip-import-path-params")

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

/**
* Gets a list of `import`/`export` declaration targets.
Expand Down
6 changes: 3 additions & 3 deletions lib/util/get-npmignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const exists = require("./exists")
const getPackageJson = require("./get-package-json")

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

/**
* Checks whether or not a given file name is a relative path to a ancestor
Expand Down
2 changes: 1 addition & 1 deletion lib/util/import-target.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = class ImportTarget {
* @param {object} options - The options of `node-resolve` module.
*/
constructor(node, name, options) {
const isModule = !/^(?:[./\\]|\w+:)/.test(name)
const isModule = !/^(?:[./\\]|\w+:)/u.test(name)

/**
* The node of a `require()` or a module declaraiton.
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fs.writeFileSync(
fs
.readFileSync(filePath, "utf8")
.replace(
/<!--RULES_TABLE_START-->[\s\S]*<!--RULES_TABLE_END-->/,
/<!--RULES_TABLE_START-->[\s\S]*<!--RULES_TABLE_END-->/u,
`<!--RULES_TABLE_START-->\n${content}\n<!--RULES_TABLE_END-->`
)
)
10 changes: 5 additions & 5 deletions tests/lib/rules/process-exit-as-throw.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ describe("process-exit-as-throw", () => {

const messages = linter.verify(code, options)

assert.equal(messages.length, 1)
assert.equal(messages[0].message, "Unreachable code.")
assert.equal(messages[0].line, 3)
assert.strictEqual(messages.length, 1)
assert.strictEqual(messages[0].message, "Unreachable code.")
assert.strictEqual(messages[0].line, 3)
}
)
;(supported ? it : xit)(
Expand All @@ -56,7 +56,7 @@ describe("process-exit-as-throw", () => {

const messages = linter.verify(code, options)

assert.equal(messages.length, 0)
assert.strictEqual(messages.length, 0)
}
)
;(supported ? it : xit)(
Expand All @@ -81,7 +81,7 @@ describe("process-exit-as-throw", () => {

const messages = linter.verify(code, options)

assert.equal(messages.length, 0)
assert.strictEqual(messages.length, 0)
}
)
})

0 comments on commit ac4cb6e

Please sign in to comment.