Merge pull request #362 from vector-im/bwindels/lintfixesandci

Fix/disable lint errors and enable in CI
This commit is contained in:
Bruno Windels 2021-05-20 09:39:41 +00:00 committed by GitHub
commit b31dc38af1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 8 deletions

1
.eslintignore Normal file
View file

@ -0,0 +1 @@
src/matrix/storage/memory

View file

@ -10,6 +10,8 @@ module.exports = {
}, },
"rules": { "rules": {
"no-console": "off", "no-console": "off",
"no-empty": "off" "no-empty": "off",
"no-prototype-builtins": "off",
"no-unused-vars": "warn",
} }
}; };

View file

@ -1,7 +1,7 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Unit tests name: Code checks
on: on:
push: push:
@ -19,10 +19,15 @@ jobs:
node-version: [14.x] node-version: [14.x]
steps: steps:
- uses: actions/checkout@v2 - name: Checkout project source
- name: Run unit tests uses: actions/checkout@v2
- name: Install tools
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- run: npm install --also=dev - name: Install project dependencies
- run: npm test run: npm install --also=dev
- name: Unit tests
run: npm test
- name: Lint
run: npm run lint-ci

1
.gitignore vendored
View file

@ -7,3 +7,4 @@ bundle.js
target target
lib lib
*.tar.gz *.tar.gz
.eslintcache

View file

@ -7,7 +7,8 @@
"doc": "doc" "doc": "doc"
}, },
"scripts": { "scripts": {
"lint": "eslint src/", "lint": "eslint --cache src/",
"lint-ci": "eslint src/",
"test": "impunity --entry-point src/main.js --force-esm-dirs lib/ src/", "test": "impunity --entry-point src/main.js --force-esm-dirs lib/ src/",
"start": "node scripts/serve-local.js", "start": "node scripts/serve-local.js",
"build": "node --experimental-modules scripts/build.mjs", "build": "node --experimental-modules scripts/build.mjs",

View file

@ -86,7 +86,7 @@ export class URLRouter {
tryRestoreLastUrl() { tryRestoreLastUrl() {
const lastNavPath = this._urlAsNavPath(this._history.getLastUrl() || ""); const lastNavPath = this._urlAsNavPath(this._history.getLastUrl() || "");
if (lastNavPath.segments.length !== 0) { if (lastNavPath.segments.length !== 0) {
this._applyNavPathToNavigation(navPath); this._applyNavPathToNavigation(lastNavPath);
return true; return true;
} }
return false; return false;