From 1f3fa44c1519d3707ea23b5bbc614b17dc8c38ff Mon Sep 17 00:00:00 2001 From: Remi Liu Date: Mon, 7 Dec 2020 15:14:42 +0800 Subject: [PATCH] infrastructure: update "engines" to node>=10.4 --- .github/workflows/codestyle.yml | 2 +- .github/workflows/downstream.yml | 2 +- .github/workflows/ecma262suite.yml | 2 +- .github/workflows/tests.yml | 8 ++++---- package.json | 2 +- src/scanner.ts | 6 +++--- src/tsconfig.json | 5 +++-- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 53f320b1c..40623d4c9 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -13,7 +13,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: 12.x + node-version: 14.x - run: npm ci - run: npm run code-style diff --git a/.github/workflows/downstream.yml b/.github/workflows/downstream.yml index 9287a56dd..bb095b5df 100644 --- a/.github/workflows/downstream.yml +++ b/.github/workflows/downstream.yml @@ -10,7 +10,7 @@ jobs: - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: - node-version: 10.x + node-version: 14.x - run: npm ci - run: npm test - run: npm run downstream diff --git a/.github/workflows/ecma262suite.yml b/.github/workflows/ecma262suite.yml index dbda98fb5..d0087088c 100644 --- a/.github/workflows/ecma262suite.yml +++ b/.github/workflows/ecma262suite.yml @@ -10,7 +10,7 @@ jobs: - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: - node-version: 10.x + node-version: 14.x - run: npm ci - run: npm test - run: npm run test-262 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ce948db9e..1a8d96f40 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [8.x, 10.x, 12.x, 14.x] + node-version: [10.x, 12.x, 14.x] steps: - uses: actions/checkout@v2 @@ -23,7 +23,7 @@ jobs: runs-on: macos-latest strategy: matrix: - node-version: [8.x, 10.x, 12.x, 14.x] + node-version: [10.x, 12.x, 14.x] steps: - uses: actions/checkout@v2 @@ -39,7 +39,7 @@ jobs: runs-on: windows-latest strategy: matrix: - node-version: [8.x, 10.x, 12.x, 14.x] + node-version: [10.x, 12.x, 14.x] steps: - run: git config --global core.autocrlf false @@ -56,7 +56,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [6.x] + node-version: [8.x] steps: - uses: actions/checkout@v2 diff --git a/package.json b/package.json index ef1147bbb..03537976c 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "dist/esprima.js" ], "engines": { - "node": ">=8" + "node": ">=10.9" }, "author": { "name": "Ariya Hidayat", diff --git a/src/scanner.ts b/src/scanner.ts index 2a746e029..1bd0c9b56 100644 --- a/src/scanner.ts +++ b/src/scanner.ts @@ -527,7 +527,7 @@ export class Scanner { // 3 digits are only allowed when string starts // with 0, 1, 2, 3 - if ('0123'.indexOf(ch) >= 0 && !this.eof() && Character.isOctalDigit(this.source.charCodeAt(this.index))) { + if ('0123'.includes(ch) && !this.eof() && Character.isOctalDigit(this.source.charCodeAt(this.index))) { code = code * 8 + octalValue(this.source[this.index++]); } } @@ -661,7 +661,7 @@ export class Scanner { // 1-character punctuators. str = this.source[this.index]; - if ('<>=!+-*%&|^/'.indexOf(str) >= 0) { + if ('<>=!+-*%&|^/'.includes(str)) { ++this.index; } } @@ -1136,7 +1136,7 @@ export class Scanner { const astralSubstitute = '\uFFFF'; let tmp = pattern; - if (flags.indexOf('u') >= 0) { + if (flags.includes('u')) { tmp = tmp // Replace every Unicode escape sequence with the equivalent // BMP character or a constant ASCII code point in the case of diff --git a/src/tsconfig.json b/src/tsconfig.json index a306e821f..21c0023ea 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -1,9 +1,10 @@ { "compilerOptions": { - "target": "ES5", + "target": "ES6", "module": "commonjs", "noImplicitAny": false, - "strict": true + "strict": true, + "lib": ["ES2015"] }, "files": [ "assert.ts",