Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 98d05ee

Browse files
ankomattphillips
authored andcommitted
Add eslint to enforce no-prototype-builtins
The way to prevent issues like mattphillips#58 is not obvious, and I would expect not all programmers to have memorised the contents of `Object.prototype`, so I think it would be prudent to check for such issues automatically. The no-prototype-builtins rule is enforced automatically by the set of rules enabled in `.eslintrc.json` by "extends": "eslint:recommended" It's a great sign that all the other enabled rules also pass without modifications! I've added the eslint invocation to `package.json`'s `posttest` field. This should make the check minimally intrusive while developing, as it will only run when the functional tests (via `jest`) pass first.
1 parent b281292 commit 98d05ee

File tree

3 files changed

+548
-3
lines changed

3 files changed

+548
-3
lines changed

‎.eslintrc.json‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true,
5+
"node": true,
6+
"jest": true
7+
},
8+
"extends": "eslint:recommended",
9+
"parserOptions": {
10+
"ecmaVersion": 12,
11+
"sourceType": "module"
12+
},
13+
"rules": {
14+
}
15+
}

‎package.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"test": "jest",
1616
"test:coverage": "yarn test -- --coverage",
1717
"test:report": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls",
18-
"test:watch": "yarn test -- --watch"
18+
"test:watch": "yarn test -- --watch",
19+
"posttest": "eslint src/"
1920
},
2021
"author": "Matt Phillips",
2122
"license": "MIT",
@@ -30,6 +31,7 @@
3031
"babel-preset-es2015": "^6.18.0",
3132
"babel-preset-stage-0": "^6.16.0",
3233
"coveralls": "^3.0.0",
34+
"eslint": "^7.10.0",
3335
"jest": "^23.6.0"
3436
},
3537
"babel": {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /