-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
6,387 additions
and
32,290 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 |
---|---|---|
@@ -1,45 +1,17 @@ | ||
/** @type {import("eslint").Linter.Config} */ | ||
module.exports = { | ||
extends: [ | ||
'./config/eslint/javascript', | ||
'./config/eslint/typescript', | ||
'./config/eslint/import', | ||
'./config/eslint/unicorn', | ||
'prettier', | ||
], | ||
plugins: ['only-warn'], | ||
reportUnusedDisableDirectives: true, | ||
env: { | ||
es6: true, | ||
browser: true, | ||
node: true, | ||
// To fix '"describe" is not defined' and | ||
// '"it" is not defined' errors in test files. | ||
mocha: true, | ||
// To fix '"expect" is not defined' error in test files. | ||
jest: true, | ||
}, | ||
extends: ['airbnb-base'], | ||
globals: { | ||
Atomics: 'readonly', | ||
SharedArrayBuffer: 'readonly', | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.js', '.ts'], | ||
}, | ||
}, | ||
}, | ||
plugins: ['@typescript-eslint'], | ||
rules: { | ||
'arrow-body-style': 'off', | ||
// To fix the 'Missing file extension "ts" for "../src"' in test folder. | ||
// https://stackoverflow.com/a/59268871/10876256 | ||
'import/extensions': [ | ||
'error', | ||
'ignorePackages', | ||
{ | ||
js: 'never', | ||
jsx: 'never', | ||
ts: 'never', | ||
tsx: 'never', | ||
}, | ||
], | ||
browser: true, | ||
}, | ||
ignorePatterns: ['dist'], | ||
}; |
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 |
---|---|---|
|
@@ -3,4 +3,3 @@ | |
node_modules | ||
dist | ||
coverage | ||
.vscode |
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,2 @@ | ||
npx lint-staged | ||
npm test |
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,3 @@ | ||
{ | ||
"typescript.tsdk": "node_modules\\typescript\\lib" | ||
} |
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,18 @@ | ||
const { resolve } = require('node:path'); | ||
|
||
/** @type {import("eslint").Linter.Config} */ | ||
module.exports = { | ||
extends: ['plugin:import/recommended', 'plugin:import/typescript'], | ||
settings: { | ||
'import/resolver': { | ||
typescript: { | ||
project: resolve(process.cwd(), 'tsconfig.json'), | ||
}, | ||
}, | ||
}, | ||
rules: { | ||
'import/first': 'warn', | ||
'import/newline-after-import': 'warn', | ||
'import/no-duplicates': 'warn', | ||
}, | ||
}; |
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 @@ | ||
/** @type {import("eslint").Linter.Config} */ | ||
module.exports = { | ||
extends: ['eslint:recommended'], | ||
rules: { | ||
'no-console': 'warn', | ||
'no-alert': 'warn', | ||
'object-shorthand': 'warn', | ||
// TODO: `curly` rule is not working when it is in this extended config file. | ||
// But it works when set in root level `.eslintrc.js`. | ||
curly: 'warn', | ||
eqeqeq: 'warn', | ||
'no-param-reassign': 'error', | ||
'prefer-template': 'warn', | ||
'no-nested-ternary': 'warn', | ||
}, | ||
}; |
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,25 @@ | ||
const { resolve } = require('node:path'); | ||
|
||
/** @type {import("eslint").Linter.Config} */ | ||
module.exports = { | ||
overrides: [ | ||
{ | ||
files: ['*.ts'], | ||
parserOptions: { | ||
project: resolve(process.cwd(), 'tsconfig.json'), | ||
}, | ||
// Contains all of recommended, recommended-type-checked, and strict, | ||
// along with additional strict rules that require type information. | ||
// https://typescript-eslint.io/linting/configs/#strict-type-checked | ||
extends: ['plugin:@typescript-eslint/strict-type-checked'], | ||
rules: { | ||
'@typescript-eslint/prefer-destructuring': 'warn', | ||
'@typescript-eslint/consistent-type-imports': 'warn', | ||
'@typescript-eslint/no-misused-promises': [ | ||
'warn', | ||
{ checksVoidReturn: false }, | ||
], | ||
}, | ||
}, | ||
], | ||
}; |
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,15 @@ | ||
/** @type {import("eslint").Linter.Config} */ | ||
module.exports = { | ||
plugins: ['unicorn'], | ||
// https://github.com/sindresorhus/eslint-plugin-unicorn/tree/main?tab=readme-ov-file#rules | ||
rules: { | ||
'unicorn/filename-case': [ | ||
'warn', | ||
{ | ||
case: 'kebabCase', | ||
}, | ||
], | ||
'unicorn/prefer-node-protocol': 'warn', | ||
'unicorn/catch-error-name': 'warn', | ||
}, | ||
}; |
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,5 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
}; |
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,4 @@ | ||
module.exports = { | ||
'*': 'prettier --write --ignore-unknown', | ||
'*.ts': 'eslint src --max-warnings 0 --fix', | ||
}; |
Oops, something went wrong.