-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add lint/format CI checks * Add eslint config file and packages * Add prettier dependency and config * Fix formatting in config files * test changed file check * fix lint and format error in changed source file
- Loading branch information
1 parent
cdb40c1
commit 8dea8a2
Showing
7 changed files
with
407 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* eslint-env node */ | ||
module.exports = { | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["@typescript-eslint", "simple-import-sort"], | ||
|
||
parserOptions: { | ||
project: true, | ||
}, | ||
|
||
extends: [ | ||
"plugin:@typescript-eslint/strict-type-checked", | ||
"plugin:@typescript-eslint/stylistic-type-checked", | ||
"prettier", | ||
], | ||
|
||
rules: { | ||
"@typescript-eslint/consistent-type-imports": "error", | ||
"simple-import-sort/imports": "error", | ||
camelcase: ["error", { properties: "always" }], | ||
eqeqeq: ["error", "always"], | ||
"prefer-const": "error", | ||
"@typescript-eslint/no-throw-literal": "error", | ||
"@typescript-eslint/switch-exhaustiveness-check": "error", | ||
// Specifically allow "_" as a placeholder argument name | ||
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_$" }], | ||
}, | ||
|
||
overrides: [ | ||
{ | ||
files: ["./*.js", "./*.mjs"], // config files | ||
env: { node: true }, | ||
extends: ["plugin:@typescript-eslint/disable-type-checked"], | ||
rules: { | ||
"@typescript-eslint/no-var-requires": "off", | ||
}, | ||
}, | ||
{ | ||
files: ["**/*.test.ts"], | ||
plugins: ["jest"], | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: lint | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: read | ||
|
||
jobs: | ||
eslint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: "npm" | ||
|
||
- run: npm ci | ||
|
||
- name: Run eslint on changed files | ||
uses: tj-actions/eslint-changed-files@v20 | ||
with: | ||
reporter: github-check | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
prettier: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: "npm" | ||
|
||
- run: npm ci | ||
|
||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v38 | ||
|
||
- run: npx prettier --check ${{ steps.changed-files.outputs.all_changed_files }} | ||
|
||
actionlint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Check workflow files | ||
uses: docker://rhysd/actionlint:latest | ||
with: | ||
args: -color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"semi": true, | ||
"tabWidth": 2, | ||
"trailingComma": "all", | ||
"useTabs": false, | ||
"printWidth": 100 | ||
} |
Oops, something went wrong.