Skip to content

Commit

Permalink
add(CI): eslint, prettier, typescript for npm related install scripts (
Browse files Browse the repository at this point in the history
…#14)

Ensure we run typescript, eslint, and prettier against the js install
scripts used in the npm install method.
  • Loading branch information
sbdchd authored Jun 17, 2020
1 parent 1a5fd0d commit 19674ba
Show file tree
Hide file tree
Showing 9 changed files with 1,435 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# don't ever lint node_modules
node_modules
.eslintrc.js
29 changes: 29 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
project: "./tsconfig.json",
},
plugins: ["@typescript-eslint", "import"],
settings: {},
env: {
node: true,
},
rules: {
"import/no-duplicates": "error",
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-explicit-any": "error",
"init-declarations": ["error", "always"],
"no-lonely-if": "error",
"object-shorthand": ["error", "always"],
"@typescript-eslint/consistent-type-assertions": [
"error",
{
assertionStyle: "never",
},
],
eqeqeq: ["error", "smart"],
},
}
39 changes: 39 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,42 @@ jobs:

- name: Test
run: ./s/test

typescript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "12.x"
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Typescript
run: ./s/tsc

eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "12.x"
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Lint JS
run: ./s/eslint

prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "12.x"
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Check Formatting
run: ./s/prettier
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
build/
node_modules/
coverage/
.venv/
.mypy_cache/
.terraform/
.pytest_cache/
target/
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"devDependencies": {
"@types/node": "^14.0.13",
"@types/node-fetch": "^2.5.7",
"@typescript-eslint/eslint-plugin": "^3.3.0",
"@typescript-eslint/parser": "^3.3.0",
"eslint": "^7.2.0",
"eslint-plugin-import": "^2.21.2",
"prettier": "^2.0.5",
"typescript": "^3.9.5"
},
"dependencies": {
Expand Down
5 changes: 5 additions & 0 deletions s/eslint
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

set -ex

./node_modules/.bin/eslint 'js/*.js'
5 changes: 5 additions & 0 deletions s/prettier
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

set -ex

./node_modules/.bin/prettier --check '**/*.{js,md,yml,json}'
5 changes: 5 additions & 0 deletions s/tsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

set -ex

./node_modules/.bin/tsc --noEmit --project tsconfig.json
Loading

0 comments on commit 19674ba

Please sign in to comment.