diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a42612f8..2abf2b5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v1 with: - node: 12.x + node: 14.x - name: Install Packages run: npm install - name: Lint @@ -28,37 +28,37 @@ jobs: strategy: matrix: - eslint: [6.x] + eslint: [7] node: [14.x] os: [ubuntu-latest] include: # On other platforms - - eslint: 6.x + - eslint: 7 node: 14.x os: windows-latest - - eslint: 6.x + - eslint: 7 node: 14.x os: macos-latest # On old Node.js versions - - eslint: 6.x + - eslint: 7 node: 12.x os: ubuntu-latest - - eslint: 6.x + - eslint: 7 node: 10.x os: ubuntu-latest - - eslint: 6.x - node: 8.x - os: ubuntu-latest # On old ESLint versions - - eslint: 5.x + - eslint: 6 + node: 14.x + os: ubuntu-latest + - eslint: 5 node: 14.x os: ubuntu-latest - - eslint: 4.x + - eslint: 4 node: 14.x os: ubuntu-latest # On the minimum supported ESLint/Node.js version - - eslint: 4.x - node: "8.0.0" + - eslint: 4 + node: 8.10.0 os: ubuntu-latest runs-on: ${{ matrix.os }} diff --git a/lib/rules/no-unicode-codepoint-escapes.js b/lib/rules/no-unicode-codepoint-escapes.js index 8b9dc98e..52e7295d 100644 --- a/lib/rules/no-unicode-codepoint-escapes.js +++ b/lib/rules/no-unicode-codepoint-escapes.js @@ -40,15 +40,15 @@ module.exports = { /** * find code point escape, and report - * @param {string} text text * @param {Node} node node * @returns {void} */ - function findAndReport(text, node) { + function findAndReport(node) { + const text = sourceCode.getText(node) for (const match of codePointEscapeSearchGenerator(text)) { const start = match.index const end = start + match[0].length - const range = [start + node.start, end + node.start] + const range = [start + node.range[0], end + node.range[0]] context.report({ node, loc: { @@ -85,15 +85,15 @@ module.exports = { return { Identifier(node) { - findAndReport(sourceCode.getText(node), node) + findAndReport(node) }, Literal(node) { if (typeof node.value === "string") { - findAndReport(node.raw, node) + findAndReport(node) } }, - TemplateElement(elementNode) { - findAndReport(elementNode.value.raw, elementNode) + TemplateElement(node) { + findAndReport(node) }, } }, diff --git a/package.json b/package.json index e243f472..6de48675 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "codecov": "^3.5.0", "eslint": "^6.2.2", "eslint4b": "^6.2.2", - "espree": "^6.1.1", + "espree": "^7.0.0", "globals": "^12.0.0", "mocha": "^6.2.0", "npm-run-all": "^4.1.5", diff --git a/tests/lib/rules/no-unicode-codepoint-escapes.js b/tests/lib/rules/no-unicode-codepoint-escapes.js index c9e9ab0d..dc4034ee 100644 --- a/tests/lib/rules/no-unicode-codepoint-escapes.js +++ b/tests/lib/rules/no-unicode-codepoint-escapes.js @@ -133,7 +133,6 @@ b="\\uD842\\uDFB7" "ES2015 Unicode code point escape sequences are forbidden.", line: 2, column: 8, - nodeType: "TemplateElement", endLine: 2, endColumn: 16, }, @@ -142,7 +141,6 @@ b="\\uD842\\uDFB7" "ES2015 Unicode code point escape sequences are forbidden.", line: 2, column: 16, - nodeType: "TemplateElement", endLine: 2, endColumn: 24, }, @@ -151,7 +149,6 @@ b="\\uD842\\uDFB7" "ES2015 Unicode code point escape sequences are forbidden.", line: 3, column: 4, - nodeType: "Literal", endLine: 3, endColumn: 13, },