Skip to content

Commit 6281a63

Browse files
committed
- Update to Unicoode 13; closes #27
- Linting: As per latest jshint (define function before called) - Testing: Use chai's `register-expect` - npm: Update devDeps (including moving from `coffee-script` to non-deprecated `coffeescript`) - npm: Simplify script running - npm: Avoid adding `package-lock.json` - npm: Update mocha per latest API - npm: Add recommended package.json fields: keywords, bugs, dependencies and change to author/contributors - Maintenance: Add `.editorconfig`
1 parent a825f91 commit 6281a63

File tree

8 files changed

+52
-27
lines changed

8 files changed

+52
-27
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
end_of_line = lf
8+
charset = utf-8
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
indent_style = space
12+
indent_size = 4
13+
14+
[*.json]
15+
indent_size = 2
16+
17+
[*.yml]
18+
indent_size = 2

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock = false

lib/keyword.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@
4343
}
4444
}
4545

46-
function isKeywordES5(id, strict) {
47-
// yield should not be treated as keyword under non-strict mode.
48-
if (!strict && id === 'yield') {
49-
return false;
50-
}
51-
return isKeywordES6(id, strict);
52-
}
53-
5446
function isKeywordES6(id, strict) {
5547
if (strict && isStrictModeReservedWordES6(id)) {
5648
return true;
@@ -82,6 +74,14 @@
8274
}
8375
}
8476

77+
function isKeywordES5(id, strict) {
78+
// yield should not be treated as keyword under non-strict mode.
79+
if (!strict && id === 'yield') {
80+
return false;
81+
}
82+
return isKeywordES6(id, strict);
83+
}
84+
8585
function isReservedWordES5(id, strict) {
8686
return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
8787
}

package.json

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "esutils",
33
"description": "utility box for ECMAScript language tools",
44
"homepage": "https://github.com/estools/esutils",
5+
"bugs": "https://github.com/estools/esutils/issues",
56
"main": "lib/utils.js",
67
"version": "2.0.4-dev",
78
"engines": {
@@ -15,30 +16,35 @@
1516
"README.md",
1617
"lib"
1718
],
18-
"maintainers": [
19-
{
20-
"name": "Yusuke Suzuki",
21-
"email": "[email protected]",
22-
"web": "http://github.com/Constellation"
23-
}
19+
"keywords": [
20+
"ecmascript"
21+
],
22+
"author": {
23+
"name": "Yusuke Suzuki",
24+
"email": "[email protected]",
25+
"web": "http://github.com/Constellation"
26+
},
27+
"contributors": [
28+
"Brett Zamir"
2429
],
2530
"repository": {
2631
"type": "git",
2732
"url": "http://github.com/estools/esutils.git"
2833
},
34+
"dependencies": {},
2935
"devDependencies": {
30-
"chai": "~1.7.2",
31-
"coffee-script": "~1.6.3",
32-
"jshint": "2.6.3",
33-
"mocha": "~2.2.1",
34-
"regenerate": "~1.3.1",
35-
"unicode-9.0.0": "~0.7.0"
36+
"chai": "~4.2.0",
37+
"coffeescript": "^2.5.1",
38+
"jshint": "2.11.0",
39+
"mocha": "~7.1.2",
40+
"regenerate": "~1.4.0",
41+
"unicode-13.0.0": "^0.8.0"
3642
},
3743
"license": "BSD-2-Clause",
3844
"scripts": {
39-
"test": "npm run-script lint && npm run-script unit-test",
45+
"test": "npm run lint && npm run unit-test",
4046
"lint": "jshint lib/*.js",
41-
"unit-test": "mocha --compilers coffee:coffee-script -R spec",
47+
"unit-test": "mocha --require chai/register-expect --require coffeescript/register test/**",
4248
"generate-regex": "node tools/generate-identifier-regex.js"
4349
}
4450
}

test/ast.coffee

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
'use strict'
2424

25-
expect = require('chai').expect
2625
esutils = require '../'
2726

2827
EMPTY = {type: 'EmptyStatement'}

test/code.coffee

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
'use strict'
2424

25-
expect = require('chai').expect
2625
esutils = require '../'
2726

2827
describe 'code', ->

test/keyword.coffee

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
'use strict'
2424

25-
expect = require('chai').expect
2625
esutils = require '../'
2726

2827
KW = [

tools/generate-identifier-regex.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
const regenerate = require('regenerate');
55

66
// Which Unicode version should be used?
7-
const version = '9.0.0';
7+
const pkg = require('../package.json');
8+
const dependencies = Object.keys(pkg.devDependencies);
9+
const unicodeDep = dependencies.find((name) => /^unicode-\d/.test(name));
10+
const version = unicodeDep.match(/[^\d]+(.+)$/)[1];
811

912
// Set up a shorthand function to import Unicode data.
1013
const get = function(what) {
11-
return require('unicode-' + version + '/' + what + '/code-points');
14+
return require('unicode-' + version + '/' + what + '/code-points.js');
1215
};
1316

1417
// Get the Unicode categories needed to construct the ES5 regex.

0 commit comments

Comments
 (0)