-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Source files not reformatted with Prettier in this commit. Move jest config to external file.
- Loading branch information
1 parent
679ef95
commit 3057cbe
Showing
12 changed files
with
1,565 additions
and
165 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,10 @@ | ||
# exclude everything, and opt-in to types we want to format | ||
**.* | ||
# add the filetypes we want to format | ||
!**.js | ||
!**.mjs | ||
!**.cjs | ||
!**.ts | ||
!**.mts | ||
!**.cts | ||
!**.json |
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,12 @@ | ||
const config = { | ||
// plugins: ['prettier-plugin-jsdoc'], | ||
singleQuote: true, | ||
overrides: [ | ||
{ | ||
files: ['tsconfig*.json'], | ||
options: { parser: 'jsonc' }, | ||
}, | ||
], | ||
}; | ||
|
||
module.exports = config; |
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,76 @@ | ||
const globals = require('globals'); | ||
const esLintjs = require('@eslint/js'); | ||
const jest = require('eslint-plugin-jest'); | ||
const tseslint = require('typescript-eslint'); | ||
const prettier = require('eslint-config-prettier'); | ||
//const jsdoc = require('eslint-plugin-jsdoc'); | ||
|
||
// Using tseslint config helper to customise its setup the tseslint way. | ||
const tsconfigTsFiles = ['**/*.{ts,mts}']; | ||
const tsconfigJsFiles = ['**.{js,mjs}']; | ||
const tseslintConfigs = tseslint.config( | ||
{ | ||
files: tsconfigJsFiles, | ||
extends: [...tseslint.configs.recommended], | ||
rules: { | ||
'@typescript-eslint/no-var-requires': 'off', // (tseslint does not autodetect commonjs context ) | ||
}, | ||
}, | ||
{ | ||
files: tsconfigTsFiles, | ||
extends: [...tseslint.configs.recommended], | ||
}, | ||
); | ||
|
||
module.exports = [ | ||
esLintjs.configs.recommended, | ||
// jsdoc.configs['flat/recommended'], | ||
jest.configs['flat/recommended'], | ||
...tseslintConfigs, | ||
prettier, // Do Prettier last so it can override previous configs. | ||
|
||
// Customise rules. | ||
{ | ||
files: ['**/*.{js,mjs,cjs}', '**/*.{ts,mts,cts}'], | ||
rules: { | ||
'no-else-return': ['error', { allowElseIf: false }], | ||
|
||
// 'jsdoc/tag-lines': 'off', | ||
// 'jsdoc/require-jsdoc': 'off', | ||
// 'jsdoc/require-param-description': 'off', | ||
// 'jsdoc/require-returns-description': 'off', | ||
}, | ||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
}, | ||
}, | ||
}, | ||
{ | ||
files: ['tests/*.{js,mjs,cjs,ts,mts,cts}'], | ||
rules: { | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/no-unused-vars': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['tests/*.test-d.ts'], | ||
rules: { | ||
'no-constant-condition': 'off', // using `if ('explanation')` for test blocks | ||
}, | ||
}, | ||
{ | ||
files: [...tsconfigTsFiles, ...tsconfigJsFiles], | ||
rules: { | ||
'@typescript-eslint/ban-ts-comment': [ | ||
'error', | ||
{ | ||
'ts-expect-error': 'allow-with-description', | ||
'ts-ignore': 'allow-with-description', | ||
'ts-nocheck': true, | ||
'ts-check': 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
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,10 @@ | ||
const config = { | ||
testEnvironment: 'node', | ||
collectCoverage: true, | ||
transform: { | ||
'^.+\\.tsx?$': ['ts-jest'], | ||
}, | ||
testPathIgnorePatterns: ['/node_modules/'], | ||
}; | ||
|
||
module.exports = config; |
Oops, something went wrong.