Skip to content
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
29 changes: 11 additions & 18 deletions packages/eslint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ Custom ESLint configuration for streamlined linting across projects.
Install dependencies:

```sh
npm i -D @prefabs.tech/eslint-config @typescript-eslint/eslint-plugin@8.14.0 @typescript-eslint/parser@8.14.0 eslint@8.57.1 eslint-config-prettier@9.1.0 eslint-import-resolver-alias@1.1.2 eslint-import-resolver-typescript@3.6.3 eslint-plugin-import@2.31.0 eslint-plugin-n@14.0.0 eslint-plugin-prettier@5.2.1 eslint-plugin-promise@7.1.0 eslint-plugin-unicorn@56.0.1 prettier@3.3.3 typescript
npm i -D @prefabs.tech/eslint-config eslint prettier typescript
```

Create a `.eslintrc.js` file:
Create a `eslint.config.js` file:

```js
module.exports = {
root: true,
extends: ["@prefabs.tech/eslint-config/fastify"],
};
import fastifyConfig from "@prefabs.tech/eslint-config/fastify.js";

export default fastifyConfig;
```

* ### For react libraries:
Expand Down Expand Up @@ -105,16 +104,16 @@ Custom ESLint configuration for streamlined linting across projects.
Install dependencies:

```sh
npm i -D @prefabs.tech/eslint-config eslint@8.57.1 @typescript-eslint/eslint-plugin@8.14.0 @typescript-eslint/parser@8.14.0 eslint@8.57.1 eslint-config-prettier@9.1.0 eslint-import-resolver-alias@1.1.2 eslint-import-resolver-typescript@3.6.3 eslint-plugin-import@2.31.0 eslint-plugin-n@14.0.0 eslint-plugin-prettier@5.2.1 eslint-plugin-promise@7.1.0 eslint-plugin-unicorn@56.0.1 prettier@3.3.3 typescript
npm i -D @prefabs.tech/eslint-config eslint prettier typescript
```

Create a `.eslintrc.js` file:
Create a `eslint.config.js` file:

```js
module.exports = {
root: true,
extends: ["@prefabs.tech/eslint-config"],
};
import config from "@prefabs.tech/eslint-config";

export default config;
```
```

## Adding linting scripts
Expand All @@ -126,12 +125,6 @@ In your `package.json`, add the following commands to the `scripts` section:
"lint:fix": "eslint . --fix"
```

* For vue projects (including .vue files):
```json
"lint": "eslint . --ext .vue",
"lint:fix": "eslint . --ext .vue --fix",
```

## Running linting
Run the following command to lint your code:

Expand Down
124 changes: 5 additions & 119 deletions packages/eslint-config/fastify.js
Original file line number Diff line number Diff line change
@@ -1,119 +1,5 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:n/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:unicorn/recommended",
"prettier",
],
overrides: [
{
files: "**/*.spec.ts",
},
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: [
"@typescript-eslint",
"import",
"n",
"prettier",
"promise",
"unicorn",
],
rules: {
curly: ["error", "all"],
"brace-style": ["error", "1tbs"],
"import/order": [
"error",
{
alphabetize: {
order: "asc",
caseInsensitive: true,
},
groups: [
"builtin",
"external",
"internal",
["parent", "sibling"],
"index",
"object",
"type",
],
"newlines-between": "always",
},
],
"n/no-unsupported-features/es-syntax": ["error", { ignores: ["modules"] }],
"n/no-unpublished-import": [
"error",
{
allowModules: ["@faker-js/faker", "mercurius-codegen", "query-string"],
},
],
"prettier/prettier": "error",
"unicorn/filename-case": [
"error",
{
cases: {
camelCase: true,
snakeCase: true,
},
},
],
"unicorn/import-style": [
"error",
{
styles: {
"node:path": {
named: true,
},
},
},
],
"unicorn/numeric-separators-style": [
"error",
{
number: {
minimumDigits: 6,
groupLength: 3,
},
},
],
// [DU 2024-SEP-10]: Disabled the 'unicorn/prefer-structured-clone' rule, which recommends using 'structuredClone'
// instead of 'JSON.parse(JSON.stringify(...))' (see: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-structured-clone.md).
// This may cause warnings when using 'JSON.parse(JSON.stringify(data))'. The reason for using this approach is unclear,
// but it could potentially lead to issues for other developers. Further review is needed to determine if 'structuredClone' should be used instead.
"unicorn/prefer-structured-clone": "off",
"unicorn/prevent-abbreviations": [
"error",
{
allowList: {
db: true,
docs: true,
env: true,
err: true,
i: true,
param: true,
req: true,
res: true,
},
},
],
},
settings: {
node: {
tryExtensions: [".js", ".json", ".node", ".ts"],
},
},
};
import baseConfig from "./index.js";

export default [
...baseConfig,
];
Loading