Add eslint, and a job in .gitlab-ci.yml to auto run linting on merges

indiachan-spamvector
Thomas Lynch 2 years ago
parent 0a3515291b
commit 30bfc09b32
Signed by: fatchan
GPG Key ID: 112884AA57DF40B1
  1. 36
      .eslintrc.json
  2. 18
      .gitlab-ci.yml
  3. 1175
      package-lock.json
  4. 2
      package.json

@ -0,0 +1,36 @@
{
"ignorePatterns": ["docker/", "tmp/", "static/", "gulp/res/css/", "gulp/res/icons/", "gulp/res/img/", "tools/", "views/", "node_modules/", "gulp/res/js/tegaki.js"],
"env": {
"node": true,
"browser": true,
"commonjs": true,
"es2021": true,
"jest/globals": true
},
"plugins": [
"jest"
],
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
"indent": [
"error",
"tab",
{ "SwitchCase": 1, "ignoreComments": true, "MemberExpression": 1 }
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
}

@ -1,7 +1,19 @@
image: node:latest
javascript:
stage: test
# Code linting
linting:
stage: eslint
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
- 'npm i -g eslint-cli'
- 'npm i eslint --save-dev'
- 'node node_modules\eslint\bin\eslint.js'
allow_failure: true
# Run tests
testing:
stage: unit-tests
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
@ -14,3 +26,5 @@ javascript:
reports:
junit:
- junit.xml
#TODO: stage: integration-tests

1175
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -53,6 +53,8 @@
"unix-crypt-td-js": "^1.1.4"
},
"devDependencies": {
"eslint": "^8.14.0",
"eslint-plugin-jest": "^26.1.5",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"jest-junit": "^13.1.0"

Loading…
Cancel
Save