@oncehub/eslint-config 3.0.1 → 3.0.3

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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/index.js +18 -20
  3. package/package.json +2 -2
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,49 +1,47 @@
1
- import js from "@eslint/js";
2
- import prettierConfig from "eslint-config-prettier";
3
- import * as typescriptEslintPlugin from "@typescript-eslint/eslint-plugin";
4
- import tsParser from "@typescript-eslint/parser";
1
+ import eslint from "@eslint/js";
2
+ import tseslint from "typescript-eslint";
5
3
  import sonarjs from "eslint-plugin-sonarjs";
4
+ import prettierConfig from "eslint-config-prettier";
5
+ import globals from "globals";
6
6
 
7
- export default [
8
- js.configs.recommended,
7
+ export default tseslint.config(
8
+ eslint.configs.recommended,
9
+ ...tseslint.configs.recommended,
9
10
  sonarjs.configs.recommended,
10
11
  prettierConfig,
11
12
  {
12
13
  files: ["**/*.{js,ts,jsx,tsx}"],
13
14
  languageOptions: {
14
15
  globals: {
16
+ ...globals.browser,
17
+ ...globals.node,
15
18
  Atomics: "readonly",
16
19
  SharedArrayBuffer: "readonly",
17
- es6: true,
18
- node: true,
19
20
  },
20
- parser: tsParser,
21
21
  parserOptions: {
22
22
  ecmaVersion: 2018,
23
23
  sourceType: "module",
24
24
  },
25
25
  },
26
- plugins: {
27
- "@typescript-eslint": typescriptEslintPlugin,
28
- // sonarjs,
29
- },
30
26
  rules: {
31
- "@typescript-eslint/no-use-before-define": "off",
32
- "@typescript-eslint/no-inferrable-types": "off",
27
+ // base rule needs to be disabled to prevent errors with the ts version
28
+ // see https://typescript-eslint.io/rules/#extension-rules
29
+ "no-unused-vars": "off",
33
30
  "@typescript-eslint/no-unused-vars": "error",
34
- "@typescript-eslint/interface-name-prefix": "off",
31
+ "@typescript-eslint/no-explicit-any": "off",
35
32
  "@typescript-eslint/consistent-type-assertions": [
36
33
  "error",
37
34
  { assertionStyle: "angle-bracket" },
38
35
  ],
39
- "@typescript-eslint/no-explicit-any": "off",
40
- "@typescript-eslint/explicit-function-return-type": "off",
41
36
  },
42
37
  },
38
+ // overriding rules specifically for test files
43
39
  {
44
40
  files: ["**/*(specs|tests)/**", "**/*.spec.ts"],
45
41
  rules: {
46
42
  "@typescript-eslint/no-empty-function": "off",
43
+ "sonarjs/no-identical-functions": "off",
44
+ "sonarjs/no-duplicate-string": "off",
47
45
  },
48
- },
49
- ];
46
+ }
47
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oncehub/eslint-config",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "ESLint configuration for micro-services built using Node.js and TypeScript",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,9 +14,9 @@
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
16
  "@eslint/js": "^9.14.0",
17
- "@types/eslint__js": "^8.42.3",
18
17
  "eslint-config-prettier": "^9.1.0",
19
18
  "eslint-plugin-sonarjs": "^2.0.4",
19
+ "globals": "^15.12.0",
20
20
  "typescript-eslint": "^8.13.0"
21
21
  },
22
22
  "peerDependencies": {