Merge pull request #74 from rastapasta/eslint

CI: Add linting with ESLint
This commit is contained in:
Michael Straßburger 2019-10-11 15:44:01 +02:00 committed by GitHub
commit 4011c877bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 80 additions and 4 deletions

View File

@ -1,9 +1,16 @@
module.exports = { module.exports = {
"env": { "env": {
"es6": true, "es6": true,
"node": true "node": true,
"jest": true
}, },
"extends": "eslint:recommended", "parserOptions": {
"ecmaVersion": 2018
},
"extends": [
"eslint:recommended",
"plugin:jest/recommended"
],
"rules": { "rules": {
"indent": [ "indent": [
"error", "error",
@ -26,4 +33,4 @@ module.exports = {
"always" "always"
] ]
} }
}; };

View File

@ -2,3 +2,8 @@ language: node_js
node_js: node_js:
- "8" - "8"
- "10" - "10"
- "12"
script:
- npm run-script lint
- npm test

62
package-lock.json generated
View File

@ -445,6 +445,12 @@
"@types/istanbul-lib-report": "*" "@types/istanbul-lib-report": "*"
} }
}, },
"@types/json-schema": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.3.tgz",
"integrity": "sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A==",
"dev": true
},
"@types/stack-utils": { "@types/stack-utils": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz",
@ -466,6 +472,47 @@
"integrity": "sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg==", "integrity": "sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg==",
"dev": true "dev": true
}, },
"@typescript-eslint/experimental-utils": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-1.13.0.tgz",
"integrity": "sha512-zmpS6SyqG4ZF64ffaJ6uah6tWWWgZ8m+c54XXgwFtUv0jNz8aJAVx8chMCvnk7yl6xwn8d+d96+tWp7fXzTuDg==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "1.13.0",
"eslint-scope": "^4.0.0"
},
"dependencies": {
"eslint-scope": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz",
"integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==",
"dev": true,
"requires": {
"esrecurse": "^4.1.0",
"estraverse": "^4.1.1"
}
}
}
},
"@typescript-eslint/typescript-estree": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-1.13.0.tgz",
"integrity": "sha512-b5rCmd2e6DCC6tCTN9GSUAuxdYwCM/k/2wdjHGrIRGPSJotWMCe/dGpi66u42bhuh8q3QBzqM4TMA1GUUCJvdw==",
"dev": true,
"requires": {
"lodash.unescape": "4.0.1",
"semver": "5.5.0"
},
"dependencies": {
"semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
"dev": true
}
}
},
"abab": { "abab": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.2.tgz", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.2.tgz",
@ -1392,6 +1439,15 @@
"v8-compile-cache": "^2.0.3" "v8-compile-cache": "^2.0.3"
} }
}, },
"eslint-plugin-jest": {
"version": "22.17.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-22.17.0.tgz",
"integrity": "sha512-WT4DP4RoGBhIQjv+5D0FM20fAdAUstfYAf/mkufLNTojsfgzc5/IYW22cIg/Q4QBavAZsROQlqppiWDpFZDS8Q==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "^1.13.0"
}
},
"eslint-scope": { "eslint-scope": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz",
@ -3565,6 +3621,12 @@
"integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=",
"dev": true "dev": true
}, },
"lodash.unescape": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz",
"integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=",
"dev": true
},
"loose-envify": { "loose-envify": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",

View File

@ -4,6 +4,7 @@
"description": "Map+Ascii -> MapSCII! Console Map Viewer.", "description": "Map+Ascii -> MapSCII! Console Map Viewer.",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
"lint": "eslint src",
"start": "node main", "start": "node main",
"test": "jest" "test": "jest"
}, },
@ -45,6 +46,7 @@
}, },
"devDependencies": { "devDependencies": {
"eslint": "^6.5.1", "eslint": "^6.5.1",
"eslint-plugin-jest": "^22.17.0",
"jest": "^24.9.0" "jest": "^24.9.0"
} }
} }

View File

@ -19,7 +19,7 @@ describe('utils', () => {
function wrapper() { function wrapper() {
utils.hex2rgb('33'); utils.hex2rgb('33');
} }
expect(wrapper).toThrowError('isn\'t a supported hex color'); expect(wrapper).toThrow('isn\'t a supported hex color');
}); });
}); });
}); });