Skip to content
Permalink
Browse files

Fix: lint errors

  • Loading branch information...
mysticatea committed Oct 27, 2018
1 parent ecf6b11 commit ac4cb6efde62b89d1c8ba15c412a3659acaae6c7
@@ -45,7 +45,7 @@ const CORE_MODULES = new Set([
"vm",
"zlib",
])
const BACK_SLASH = /\\/g
const BACK_SLASH = /\\/gu

module.exports = {
meta: {
@@ -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)

@@ -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",
@@ -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"],
@@ -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
@@ -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.
@@ -89,7 +89,7 @@ module.exports = {
filePath = path.join(
basedir,
getConvertPath(context)(
path.relative(basedir, filePath).replace(/\\/g, "/")
path.relative(basedir, filePath).replace(/\\/gu, "/")
)
)

@@ -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)
@@ -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()

/**
@@ -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({
@@ -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.
@@ -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
@@ -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.
@@ -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-->`
)
)
@@ -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)(
@@ -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)(
@@ -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.
You can’t perform that action at this time.