-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up tooling: prettier, knip, eslint, GitHub Actions (#22)
* install knip * set up knip * prepare for prettier * more prettier config * format with prettier * format on save * set up / pass eslint * try to enable recommendedTypeChecked * lint tsx files, too * eslint strictTypeCheck * enable some stylistic rules * workflow
- Loading branch information
Showing
32 changed files
with
1,800 additions
and
1,423 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
# Ignore artifacts: | ||
build | ||
coverage | ||
bundle | ||
static | ||
id4-to-location | ||
by-location | ||
dist | ||
data.json | ||
rotated-assets | ||
*.html | ||
popular.json | ||
styles/octicons | ||
timestamps.json | ||
# this one is generated | ||
src/popular-photos.js |
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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"[typescript]": { | ||
"editor.formatOnSave": true | ||
}, | ||
"[typescriptreact]": { | ||
"editor.formatOnSave": true | ||
} | ||
} |
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 @@ | ||
// @ts-check | ||
|
||
import tsPlugin from '@typescript-eslint/eslint-plugin'; | ||
import eslint from '@eslint/js'; | ||
import tseslint from 'typescript-eslint'; | ||
|
||
export default tseslint.config( | ||
eslint.configs.recommended, | ||
|
||
// See https://stackoverflow.com/a/64488474/388951 | ||
...tseslint.configs.recommendedTypeChecked.map((config) => ({ | ||
...config, | ||
files: ['src/**/*.{ts,tsx}'], // We use TS config only for TS files | ||
})), | ||
...tseslint.configs.stylisticTypeChecked.map((config) => ({ | ||
...config, | ||
files: ['src/**/*.{ts,tsx}'], // We use TS config only for TS files | ||
})), | ||
{ | ||
files: ['src/**/*.{ts,tsx}'], | ||
|
||
// This is required, see the docs | ||
languageOptions: { | ||
parserOptions: { | ||
project: true, | ||
tsconfigRootDir: import.meta.dirname | ||
}, | ||
}, | ||
|
||
// This is needed in order to specify the desired behavior for its rules | ||
plugins: { | ||
'@typescript-eslint': tsPlugin, | ||
}, | ||
|
||
// After defining the plugin, you can use the rules like this | ||
rules: { | ||
// Sometimes it's convenient to give the index a name. | ||
'@typescript-eslint/consistent-indexed-object-style': 'off', | ||
'@typescript-eslint/array-type': 'off', // ['error', {default: "array-simple"}], | ||
} | ||
} | ||
); |
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,14 @@ | ||
{ | ||
"entry": ["src/main.tsx", "src/ocr-tool.ts"], | ||
"project": ["src/**/*.{ts,tsx}"], | ||
"ignoreExportsUsedInFile": true, | ||
"ignoreDependencies": [ | ||
// My build script throws off knip | ||
"dist", | ||
// @types dependencies that define ambient types | ||
"@types/google.analytics", | ||
"@types/google.maps", | ||
"@types/jquery", | ||
"@types/twitter-for-web" | ||
] | ||
} |
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
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
Oops, something went wrong.