@oncehub/eslint-config 3.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/index.js +22 -18
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
> ESLint configuration for services built with Node.js and TypeScript.
|
|
6
6
|
|
|
7
|
-
The configuration extends `@typescript-eslint/recommended`, `eslint-plugin-sonarjs`, `prettier` ESLint configurations.
|
|
7
|
+
The configuration exports and extends `@typescript-eslint/recommended`, `eslint-plugin-sonarjs`, `prettier` ESLint configurations.
|
|
8
8
|
|
|
9
9
|
It is compatible with ESlint >= v9 configuration format (flat config).
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ Note that it requires ESlint v9 and above.
|
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
|
-
Import the package inside of an eslint.config.js file and add it into the exported array, like this:
|
|
23
|
+
Import the package inside of an `eslint.config.js` file and add it into the exported array, like this:
|
|
24
24
|
|
|
25
25
|
```js
|
|
26
26
|
// eslint.config.js
|
package/index.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import eslint from "@eslint/js";
|
|
2
|
+
import react from "eslint-plugin-react";
|
|
3
|
+
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
4
|
+
import importPlugin from "eslint-plugin-import";
|
|
5
|
+
import tseslint from "typescript-eslint";
|
|
5
6
|
import sonarjs from "eslint-plugin-sonarjs";
|
|
7
|
+
import prettierConfig from "eslint-config-prettier";
|
|
6
8
|
import globals from "globals";
|
|
7
9
|
|
|
8
|
-
export default
|
|
9
|
-
|
|
10
|
+
export default tseslint.config(
|
|
11
|
+
eslint.configs.recommended,
|
|
12
|
+
...tseslint.configs.recommended,
|
|
13
|
+
importPlugin.flatConfigs.recommended,
|
|
14
|
+
react.configs.flat.recommended,
|
|
15
|
+
react.configs.flat["jsx-runtime"],
|
|
16
|
+
jsxA11y.flatConfigs.recommended,
|
|
10
17
|
sonarjs.configs.recommended,
|
|
11
18
|
prettierConfig,
|
|
12
19
|
{
|
|
@@ -18,33 +25,30 @@ export default [
|
|
|
18
25
|
Atomics: "readonly",
|
|
19
26
|
SharedArrayBuffer: "readonly",
|
|
20
27
|
},
|
|
21
|
-
parser: tsParser,
|
|
22
28
|
parserOptions: {
|
|
23
29
|
ecmaVersion: 2018,
|
|
24
30
|
sourceType: "module",
|
|
25
31
|
},
|
|
26
32
|
},
|
|
27
|
-
plugins: {
|
|
28
|
-
"@typescript-eslint": typescriptEslintPlugin,
|
|
29
|
-
// sonarjs,
|
|
30
|
-
},
|
|
31
33
|
rules: {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
// base rule needs to be disabled to prevent errors with the ts version
|
|
35
|
+
// see https://typescript-eslint.io/rules/#extension-rules
|
|
36
|
+
"no-unused-vars": "off",
|
|
34
37
|
"@typescript-eslint/no-unused-vars": "error",
|
|
35
|
-
"@typescript-eslint/
|
|
38
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
36
39
|
"@typescript-eslint/consistent-type-assertions": [
|
|
37
40
|
"error",
|
|
38
41
|
{ assertionStyle: "angle-bracket" },
|
|
39
42
|
],
|
|
40
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
41
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
42
43
|
},
|
|
43
44
|
},
|
|
45
|
+
// overriding rules specifically for test files
|
|
44
46
|
{
|
|
45
47
|
files: ["**/*(specs|tests)/**", "**/*.spec.ts"],
|
|
46
48
|
rules: {
|
|
47
49
|
"@typescript-eslint/no-empty-function": "off",
|
|
50
|
+
"sonarjs/no-identical-functions": "off",
|
|
51
|
+
"sonarjs/no-duplicate-string": "off",
|
|
48
52
|
},
|
|
49
|
-
}
|
|
50
|
-
|
|
53
|
+
}
|
|
54
|
+
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oncehub/eslint-config",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "ESLint configuration for micro-services built using Node.js and TypeScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,12 +13,14 @@
|
|
|
13
13
|
"author": "Rajat Saxena <rajat.saxena@oncehub.com>",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@eslint/js": "
|
|
17
|
-
"
|
|
18
|
-
"eslint-
|
|
19
|
-
"eslint-plugin-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
16
|
+
"@eslint/js": "9.16.0",
|
|
17
|
+
"eslint-config-prettier": "9.1.0",
|
|
18
|
+
"eslint-plugin-import": "2.31.0",
|
|
19
|
+
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
20
|
+
"eslint-plugin-react": "7.37.2",
|
|
21
|
+
"eslint-plugin-sonarjs": "3.0.1",
|
|
22
|
+
"globals": "15.13.0",
|
|
23
|
+
"typescript-eslint": "8.18.0"
|
|
22
24
|
},
|
|
23
25
|
"peerDependencies": {
|
|
24
26
|
"eslint": ">= 9"
|