Skip to content

Commit c33101b

Browse files
committed
🚨 chore(api) fix scripts linter config
1 parent 5b0befa commit c33101b

File tree

3 files changed

+100
-15
lines changed

3 files changed

+100
-15
lines changed

scripts/.eslintrc.cjs

-8
This file was deleted.

scripts/eslint.config.mjs

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import pixRecommendedConfig from "@1024pix/eslint-plugin/config";
2+
import babelParser from "@babel/eslint-parser";
3+
import { fixupPluginRules } from "@eslint/compat";
4+
import chai from "eslint-plugin-chai-expect";
5+
import _import from "eslint-plugin-import-x";
6+
import knex from "eslint-plugin-knex";
7+
import mocha from "eslint-plugin-mocha";
8+
import nRecommendedConfig from "eslint-plugin-n";
9+
import prettierRecommendedConfig from "eslint-plugin-prettier/recommended";
10+
import unicorn from "eslint-plugin-unicorn";
11+
12+
export default [
13+
...pixRecommendedConfig,
14+
prettierRecommendedConfig,
15+
nRecommendedConfig.configs["flat/recommended"],
16+
{ plugins: { "chai-expect": fixupPluginRules(chai) } },
17+
{ plugins: { import: _import } },
18+
{ plugins: { knex: fixupPluginRules(knex) } },
19+
{ plugins: { unicorn } },
20+
{
21+
files: ["eslint.config.mjs"],
22+
languageOptions: {
23+
parser: babelParser,
24+
parserOptions: {
25+
ecmaVersion: 2020,
26+
sourceType: "module",
27+
requireConfigFile: false,
28+
babelOptions: {
29+
configFile: false,
30+
babelrc: false,
31+
parserOpts: {
32+
plugins: ["importAttributes"],
33+
},
34+
},
35+
},
36+
},
37+
rules: {
38+
"n/no-unpublished-import": "off",
39+
},
40+
},
41+
{
42+
files: ["**/*.js"],
43+
languageOptions: {
44+
parser: babelParser,
45+
parserOptions: {
46+
ecmaVersion: 2020,
47+
sourceType: "module",
48+
requireConfigFile: false,
49+
babelOptions: {
50+
configFile: false,
51+
babelrc: false,
52+
parserOpts: {
53+
plugins: ["importAttributes"],
54+
},
55+
},
56+
},
57+
},
58+
rules: {
59+
"no-console": "error",
60+
"no-sync": "error",
61+
"knex/avoid-injections": "error",
62+
"no-empty-function": "error",
63+
"n/no-process-exit": "error",
64+
"unicorn/no-empty-file": "error",
65+
"unicorn/prefer-node-protocol": "error",
66+
"n/no-unpublished-import": "off",
67+
"import/no-restricted-paths": [
68+
"error",
69+
{
70+
zones: [
71+
{
72+
target: ["api/lib/domain/usecases", "lib/domain/usecases"],
73+
from: [
74+
"api/lib/infrastructure/repositories",
75+
"lib/infrastructure/repositories",
76+
],
77+
except: [],
78+
message:
79+
"Repositories are automatically injected in use-case, you don't need to import them. Check for further details: https://github.com/1024pix/pix/blob/dev/docs/adr/0046-injecter-les-dependances-api.md",
80+
},
81+
{ target: "tests/unit", from: "db" },
82+
],
83+
},
84+
],
85+
},
86+
},
87+
{
88+
...mocha.configs.flat.recommended,
89+
files: ["tests/**/*.js"],
90+
rules: {
91+
...mocha.configs.flat.recommended.rules,
92+
"mocha/no-hooks-for-single-case": "off",
93+
"mocha/no-exclusive-tests": "error",
94+
"mocha/no-pending-tests": "error",
95+
"mocha/no-skipped-tests": "error",
96+
"mocha/no-top-level-hooks": "error",
97+
"mocha/no-setup-in-describe": ["error"],
98+
},
99+
},
100+
];

scripts/tests/.eslintrc.cjs

-7
This file was deleted.

0 commit comments

Comments
 (0)