From a82d4c44e02905e8b5c8323a9620d81a657b7a8b Mon Sep 17 00:00:00 2001 From: ylemkimon Date: Sun, 30 Aug 2020 10:09:47 +0900 Subject: [PATCH] test: lint all js files and inline scripts in workflow (#2442) * Lint all js files Closes #2414 * Lint inline scripts in workflow * Upgrade eslint-plugin-actions to 1.0.1 Test plan: 1. Add `console` statement to the script in `.github/workflows/ci.yml` 2. Check `no-console` error is shown in `eslint` --- .eslintignore | 1 + .eslintrc | 8 +++++++- package.json | 3 ++- yarn.lock | 14 +++++++++++++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.eslintignore b/.eslintignore index 206e3a31..6ef3f360 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,5 @@ **/node_modules/* +**/flow-typed/* dist/* website/build/* website/lib/remarkable-katex.js diff --git a/.eslintrc b/.eslintrc index 47609268..c1ba753d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -5,7 +5,8 @@ ], "extends": [ "eslint:recommended", - "plugin:flowtype/recommended" + "plugin:flowtype/recommended", + "plugin:actions/recommended" ], "rules": { "arrow-spacing": 2, @@ -101,6 +102,11 @@ "rules": { "react/prop-types": 0 } + }, { + "files": [".github/workflows/*.{yaml,yml}/**/*.js"], + "rules": { + "indent-legacy": [2, 4, {"SwitchCase": 1, "outerIIFEBody": 0}], + } }], "root": true } diff --git a/package.json b/package.json index 138e8dce..9bacbcbc 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "css-loader": "^4.0.0", "cssnano": "^4.1.10", "eslint": "^7.4.0", + "eslint-plugin-actions": "^1.0.1", "eslint-plugin-flowtype": "^5.2.0", "eslint-plugin-react": "^7.20.3", "file-loader": "^6.0.0", @@ -83,7 +84,7 @@ "scripts": { "test": "yarn test:lint && yarn test:flow && yarn test:jest", "test:lint": "yarn test:lint:js && yarn test:lint:css", - "test:lint:js": "eslint *.js src static test contrib dockers website", + "test:lint:js": "eslint .", "test:lint:css": "stylelint src/katex.less static/main.css contrib/**/*.css website/static/**/*.css", "test:flow": "flow", "test:jest": "jest", diff --git a/yarn.lock b/yarn.lock index 82a3705a..ec8b289d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4619,6 +4619,17 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-actions@npm:^1.0.1": + version: 1.0.1 + resolution: "eslint-plugin-actions@npm:1.0.1" + dependencies: + yaml: ^1.10.0 + peerDependencies: + eslint: ^6.7.0 || ^7.0.0 + checksum: a869d6bad48a0d405a4521aecdf6cbb2cc213566711e72e8d7d809529724455bc1981845a57a61ff790bcedf03b7bd792e9daf8b11637003cf096b4d74365c88 + languageName: node + linkType: hard + "eslint-plugin-flowtype@npm:^5.2.0": version: 5.2.0 resolution: "eslint-plugin-flowtype@npm:5.2.0" @@ -7597,6 +7608,7 @@ fsevents@^1.2.7: css-loader: ^4.0.0 cssnano: ^4.1.10 eslint: ^7.4.0 + eslint-plugin-actions: ^1.0.1 eslint-plugin-flowtype: ^5.2.0 eslint-plugin-react: ^7.20.3 file-loader: ^6.0.0 @@ -13552,7 +13564,7 @@ fsevents@^1.2.7: languageName: node linkType: hard -"yaml@npm:^1.7.2": +"yaml@npm:^1.10.0, yaml@npm:^1.7.2": version: 1.10.0 resolution: "yaml@npm:1.10.0" checksum: d4cc9f9724f8d0aebc2cf52e4e6aa7059f12d50deb54b5225d103462fb2af36e5c0bb419101ca4b1f0cd3b4db9e4139cf2c690e863ac6227648d39d6f4e2522c