-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update packages and typescript config
- Loading branch information
Showing
4 changed files
with
693 additions
and
4,554 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,40 +1,27 @@ | ||
const {FlatCompat} = require('@eslint/eslintrc') | ||
const eslint = require('@eslint/js') | ||
const tseslint = require('typescript-eslint') | ||
const escompatPlugin = require('eslint-plugin-escompat') | ||
const github = require('../../plugin') | ||
|
||
const compat = new FlatCompat({resolvePluginsRelativeTo: __dirname}) | ||
|
||
const typescriptModule = { | ||
...compat.config({ | ||
extends: ['plugin:@typescript-eslint/recommended', 'prettier', 'plugin:escompat/typescript-2020'], | ||
plugins: ['@typescript-eslint', 'escompat'], | ||
parser: '@typescript-eslint/parser', | ||
rules: { | ||
camelcase: 'off', | ||
'no-unused-vars': 'off', | ||
'no-shadow': 'off', | ||
'no-invalid-this': 'off', | ||
'@typescript-eslint/no-invalid-this': ['error'], | ||
'@typescript-eslint/no-shadow': ['error'], | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}], | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'@typescript-eslint/explicit-member-accessibility': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/no-unused-vars': 'error', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
}, | ||
}), | ||
} | ||
// Need to merge to get the appropriate structure for the config | ||
const mergedConfig = {} | ||
|
||
for (const obj of Object.values(typescriptModule)) { | ||
Object.assign(mergedConfig, { | ||
languageOptions: {...mergedConfig.languageOptions, ...obj.languageOptions}, | ||
plugins: {...mergedConfig.plugins, ...obj.plugins}, | ||
rules: {...mergedConfig.rules, ...obj.rules}, | ||
files: [...(mergedConfig.files || []), ...(obj.files || [])], | ||
}) | ||
} | ||
|
||
module.exports = mergedConfig | ||
module.exports = tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, { | ||
languageOptions: { | ||
parser: tseslint.parser, | ||
}, | ||
plugins: {'@typescript-eslint': tseslint.plugin, escompatPlugin, github}, | ||
rules: { | ||
camelcase: 'off', | ||
'no-unused-vars': 'off', | ||
'no-shadow': 'off', | ||
'no-invalid-this': 'off', | ||
'@typescript-eslint/no-invalid-this': ['error'], | ||
'@typescript-eslint/no-shadow': ['error'], | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}], | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'@typescript-eslint/explicit-member-accessibility': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/no-unused-vars': 'error', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
}, | ||
}) |
Oops, something went wrong.