Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down
14 changes: 7 additions & 7 deletions lib/rules/no-unicode-codepoint-escapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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)
},
}
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions tests/lib/rules/no-unicode-codepoint-escapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -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,
},
Expand Down