-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable strict type checked rules (#392)
* Make usage of null/undefined more consistent. Primarily allowing either value for user input. * add explicit return type to canonicalDomain * add note for weird parse behavior * use @typescript-eslint/strict-type-checked * eslint auto fixes * remove unnecessary polyfill * manual fixes for strict rules * Update lib/cookie/cookie.ts Co-authored-by: Colin Casey <casey.colin@gmail.com> * Replace `Nullable<T>` with more precise `T | undefined` * add a bit of breathing room to the file size * Change `parse` to only return undefined on failure, nut null | undefined. * standardize helpers on returning undefined * update doc for return type * Fix a few more errors. * appease linter * change fromJSON to return undefined instead of null * fix incorrect comparison * change date helpers to avoid null, for consistency * update fromJSON tests for new return type * change internal null value to undefined * add type annotations * move from .eslintrc to flat config * linter fixes for vows tests * fixes for restrict-template-expressions * Avoid type linting eslint.config.mjs * fix package-lock.json * bump deps * fix package-lock.json again * restore missing dependency * revert changes to test files * disable no-unused-vars lint rule * fix no-case-declarations violation * remove max-lines enforcement we've decided it doesn't really add value * fix types and disable false positive eslint errors * fix package-lock.json I always mangle it :( * don't need to disable a rule that's never enabled missed a spot --------- Co-authored-by: Colin Casey <casey.colin@gmail.com>
- Loading branch information
1 parent
4e04082
commit 460bbe1
Showing
17 changed files
with
1,844 additions
and
8,680 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,41 @@ | ||
// @ts-check | ||
|
||
import eslint from '@eslint/js' | ||
import prettierRecommended from 'eslint-plugin-prettier/recommended' | ||
import tseslint from 'typescript-eslint' | ||
import globals from 'globals' | ||
|
||
export default tseslint.config( | ||
{ | ||
ignores: ['dist', 'jest.config.ts'], | ||
}, | ||
eslint.configs.recommended, | ||
...tseslint.configs.strictTypeChecked, | ||
prettierRecommended, | ||
{ | ||
languageOptions: { | ||
globals: globals.node, | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
tsconfigDirName: import.meta.dirname, | ||
}, | ||
}, | ||
linterOptions: { | ||
reportUnusedDisableDirectives: 'warn', | ||
}, | ||
rules: { | ||
'@typescript-eslint/explicit-function-return-type': 'error', | ||
}, | ||
}, | ||
{ | ||
// Once we remove the legacy vows tests in ./test, we can remove these JS-specific rules | ||
files: ['test/**/*.js', 'eslint.config.mjs'], | ||
...tseslint.configs.disableTypeChecked, | ||
rules: { | ||
...tseslint.configs.disableTypeChecked.rules, | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/no-unused-vars': 'off', | ||
}, | ||
}, | ||
) |
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
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.