Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove non-TS config files #604

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ 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, looseTypes, configWithoutJest, configWithoutTypescript } from '@fishbrain/eslint-config-base';
import { config, looseTypes, configWithoutJest } from '@fishbrain/eslint-config-base';

export default [
...config, // or configWithoutJest or configWithoutTypescript depending on the needs of the project.
...config, // or configWithoutJest if the project doesn't use Jest.
...looseTypes, // Use this if the project is poorly typed.
];
```
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.1.2",
"version": "6.1.3",
"workspaces": [
"packages/*"
],
Expand Down
36 changes: 9 additions & 27 deletions packages/base/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,6 @@ const baseConfig = [
];

const customRules = {
rules: {
curly: ['error', 'all'],
'max-lines': ['error', { max: 300, skipComments: true }],
'no-magic-numbers': [
'error',
{ ignoreArrayIndexes: true, ignore: ALLOWED_NUMBERS },
],
'prettier/prettier': 'error',
'require-atomic-updates': 'error',
},
};

const customRulesTypescript = {
rules: {
'@typescript-eslint/no-empty-function': 'off', // Noop functions are a common pattern we use during testing, so we don't want to enable it.
'@typescript-eslint/no-explicit-any': ['error', { fixToUnknown: true }],
Expand All @@ -67,29 +54,24 @@ const customRulesTypescript = {
allowNumber: true,
},
],
curly: ['error', 'all'],
'max-lines': ['error', { max: 300, skipComments: true }],
'no-magic-numbers': [
'error',
{ ignoreArrayIndexes: true, ignore: ALLOWED_NUMBERS },
],
'prettier/prettier': 'error',
'require-atomic-updates': 'error',
},
};

export const configWithoutTypescript = [
eslint.configs.recommended,
{ plugins: { prettier: prettierPlugin } },
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
jestPlugin.configs['flat/recommended'],
customRules,
];

export const configWithoutJest = tseslint.config(
...baseConfig,
customRules,
customRulesTypescript,
);
export const configWithoutJest = tseslint.config(...baseConfig, customRules);

export const config = tseslint.config(
...baseConfig,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
jestPlugin.configs['flat/recommended'],
customRules,
customRulesTypescript,
);

/* 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. */
Expand Down
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": "[email protected]",
"version": "6.1.2",
"version": "6.1.3",
"type": "module",
"exports": "./index.js",
"scripts": {
Expand Down
7 changes: 0 additions & 7 deletions packages/react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ const customRules = {
},
};

export const configWithoutTypescript = [
...baseConfig,
...reactConfig,
...testingConfig,
customRules,
];

export const config = tseslint.config(
...baseConfig,
...reactConfig,
Expand Down
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": "[email protected]",
"version": "6.1.2",
"version": "6.1.3",
"type": "module",
"exports": "./index.js",
"scripts": {
Expand Down