Skip to content

Commit

Permalink
Add a way to loosen type checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lhansford committed Sep 9, 2024
1 parent dc14331 commit b3a63eb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ Create a file in the root of your project named `eslint.config.js`, or `eslint.c
Populate it with the following content:

```js
import { config } from '@fishbrain/eslint-config-base';
import { config, looseTypes, configWithoutJest } from '@fishbrain/eslint-config-base';

export default [
...config,
...config, // or configWithoutJest if the project doesn't use Jest.
...looseTypes, // Use this if the project is poorly typed.
];
```

Finally you can run linting with a script in `package.json`. Note that we reference ESLint from `node_modules` directly
You can run linting with a script in `package.json`. Note that we reference ESLint from `node_modules` directly
as it's installed as a dependency of our config and is not available by calling `eslint`:

```json
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@fishbrain/eslint-config-monorepo",
"private": true,
"description": "ESLint configs for Fishbrain projects",
"version": "6.0.6",
"version": "6.0.7",
"workspaces": [
"packages/*"
],
Expand Down
13 changes: 13 additions & 0 deletions packages/base/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,16 @@ export const config = tseslint.config(
jestPlugin.configs['flat/recommended'],
customRules,
);

/* Use this if your project is not well typed yet (e.g. lots of `any` types). Ideally you should not use this, but in some cases it may be necessary. */
export const looseTypes = [
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
},
},
];
2 changes: 1 addition & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fishbrain/eslint-config-base",
"packageManager": "yarn@4.4.1",
"version": "6.0.6",
"version": "6.0.7",
"type": "module",
"exports": "./index.js",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions packages/react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import globals from 'globals';
import {
config as baseConfig,
configWithoutJest as baseConfigWithoutJest,
looseTypes as baseLooseTypes,
} from '@fishbrain/eslint-config-base';

const reactConfig = [
Expand Down Expand Up @@ -56,3 +57,5 @@ export const configWithoutJest = tseslint.config(
...reactConfig,
customRules,
);

export const looseTypes = baseLooseTypes;
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fishbrain/eslint-config-react",
"packageManager": "yarn@4.4.1",
"version": "6.0.6",
"version": "6.0.7",
"type": "module",
"exports": "./index.js",
"scripts": {
Expand Down

0 comments on commit b3a63eb

Please sign in to comment.