Skip to content

Commit

Permalink
Eslint ts config (#3)
Browse files Browse the repository at this point in the history
* Override lint config for .ts, .test.ts files

* Bump package version
  • Loading branch information
jamesdabbs authored Mar 30, 2021
1 parent d9544d4 commit a9ee170
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 26 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pi-base/dev",
"version": "0.0.2",
"version": "0.0.3",
"description": "Developer utilities for pi-base packages",
"keywords": [
"Node"
Expand Down
43 changes: 27 additions & 16 deletions src/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ const js = {
],
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking'
'plugin:prettier/recommended'
],
rules: {
"jest/no-focused-tests": "error",
Expand All @@ -23,24 +21,37 @@ const js = {
},
}

const ts = {
...js,
files: ["**/*.ts", "**/*.tsx"],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json'
},
plugins: [...js.plugins, '@typescript-eslint'],
extends: [
...js.extends,
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking'
]
}

const tsTest = {
...ts,
files: ["**/*.test.ts", "**/*.test.tsx"],
rules: {
...ts.rules,
// Allow test matches to fail and cause an error in the test
'@typescript-eslint/no-non-null-assertion': 'off',
}
}

module.exports = {
...js,
ignorePatterns: ['*.d.ts'],
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
],
overrides: [{
files: ["**/*.ts", "**/*.tsx"],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json'
},
plugins: [...js.plugins, '@typescript-eslint'],
extends: [
...js.extends,
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking'
]
}]
overrides: [ts, tsTest]
}
3 changes: 2 additions & 1 deletion tsconfig.shared.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"noUnusedParameters": true,
},
"include": [
"src/**/*.ts"
"src/**/*.ts",
"src/*.ts"
],
"exclude": [
"node_modules"
Expand Down

0 comments on commit a9ee170

Please sign in to comment.