@kontent-ai/eslint-config 2.0.3 → 2.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.
Files changed (4) hide show
  1. package/README.md +24 -15
  2. package/index.js +17 -11
  3. package/package.json +9 -5
  4. package/react.js +9 -9
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  # Kontent.ai eslint configuration
12
12
 
13
- This is the eslint configuration that Kontent.ai uses for its TypeScript packages.
13
+ This is the eslint configuration that Kontent.ai uses for its TypeScript packages. This package uses ESLint 9+ Flat Config format.
14
14
 
15
15
  # Getting Started
16
16
 
@@ -22,26 +22,35 @@ This is the eslint configuration that Kontent.ai uses for its TypeScript package
22
22
  npm i --save-dev @kontent-ai/eslint-config
23
23
  ```
24
24
 
25
- 1. [Extend](https://eslint.org/docs/latest/use/configure/configuration-files#extending-configuration-files) your eslint configuration
26
-
27
- ```jsonc
28
- // showcase of .eslintrc.json
29
- {
30
- // ...
31
- "extends": [
32
- // ...
33
- "@kontent-ai",
34
- "@kontent-ai/eslint-config/react"
35
- ]
36
- }
25
+ 1. Extend the configuration in your `eslint.config.js` file (Flat Config format for ESLint 9+ is required)
26
+
27
+ ```js
28
+ // eslint.config.js
29
+ import kontentAiConfig from "@kontent-ai/eslint-config";
30
+ import { defineConfig } from "eslint/config";
31
+
32
+ export default defineConfig({
33
+ extends: [ kontentAiConfig ],
34
+ });
35
+ ```
36
+
37
+ For React projects, use the React-specific configuration:
38
+
39
+ ```js
40
+ // eslint.config.js
41
+ import kontentAiReactConfig from "@kontent-ai/eslint-config/react";
42
+ import { defineConfig } from "eslint/config";
43
+
44
+ export default defineConfig({
45
+ extends: [ kontentAiReactConfig ],
46
+ });
37
47
  ```
38
48
 
39
49
  1. Run the lint process based on your project configuration
40
50
 
41
51
  Available configurations are:
42
- * `@kontent-ai` (default configuration for any TypeScript file)
52
+ * `@kontent-ai/eslint-config` (default configuration for any TypeScript file)
43
53
  * `@kontent-ai/eslint-config/react` (react specific, extends default)
44
- * `@kontent-ai/eslint-config/jest` (jest specific, extends default)
45
54
 
46
55
  # License
47
56
 
package/index.js CHANGED
@@ -1,20 +1,26 @@
1
- module.exports = {
2
- parser: "@typescript-eslint/parser",
3
- parserOptions: {
4
- project: "./tsconfig.json",
5
- ecmaFeatures: {
6
- jsx: true,
1
+ import tsParser from "@typescript-eslint/parser";
2
+ import tsPlugin from "@typescript-eslint/eslint-plugin";
3
+ import { defineConfig } from "eslint/config";
4
+
5
+ export default defineConfig([{
6
+ languageOptions: {
7
+ parser: tsParser,
8
+ parserOptions: {
9
+ project: "./tsconfig.json",
10
+ ecmaFeatures: {
11
+ jsx: true,
12
+ },
13
+ sourceType: "module",
7
14
  },
8
- sourceType: "module",
15
+ },
16
+ plugins: {
17
+ "@typescript-eslint": tsPlugin,
9
18
  },
10
19
  settings: {
11
20
  react: {
12
21
  version: "detect",
13
22
  },
14
23
  },
15
- plugins: [
16
- "@typescript-eslint",
17
- ],
18
24
  rules: {
19
25
  "no-duplicate-imports": "error",
20
26
  "no-promise-executor-return": "error",
@@ -54,4 +60,4 @@ module.exports = {
54
60
  "@typescript-eslint/no-unsafe-enum-comparison": "error",
55
61
  "@typescript-eslint/strict-boolean-expressions": "warn",
56
62
  },
57
- };
63
+ }]);
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "@kontent-ai/eslint-config",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "description": "Eslint configuration used for packages in Kontent.ai",
5
5
  "main": "index.js",
6
6
  "private": false,
7
7
  "type": "module",
8
+ "exports": {
9
+ ".": "./index.js",
10
+ "./react": "./react.js"
11
+ },
8
12
  "scripts": {},
9
13
  "author": "Jiri Lojda",
10
14
  "license": "MIT",
11
15
  "dependencies": {
12
- "@typescript-eslint/eslint-plugin": "^8.1.0",
13
- "@typescript-eslint/parser": "^8.1.0",
14
- "eslint": "^9.9.0",
15
- "eslint-plugin-react": "^7.35.0"
16
+ "@typescript-eslint/eslint-plugin": "^8.46.3",
17
+ "@typescript-eslint/parser": "^8.46.3",
18
+ "eslint": "^9.39.1",
19
+ "eslint-plugin-react": "^7.37.5"
16
20
  }
17
21
  }
package/react.js CHANGED
@@ -1,12 +1,12 @@
1
- module.exports = {
2
- plugins: [
3
- "react",
4
- ],
5
-
6
- extends: [
7
- "@kontent-ai",
8
- ],
1
+ import reactPlugin from "eslint-plugin-react";
2
+ import baseConfig from "./index.js";
3
+ import { defineConfig } from "eslint/config";
9
4
 
5
+ export default defineConfig([{
6
+ extends: [baseConfig],
7
+ plugins: {
8
+ react: reactPlugin,
9
+ },
10
10
  rules: {
11
11
  "react/jsx-boolean-value": "error",
12
12
  "react/jsx-equals-spacing": "error",
@@ -50,4 +50,4 @@ module.exports = {
50
50
  "react/jsx-no-leaked-render": "error",
51
51
  "react/prefer-stateless-function": "error",
52
52
  },
53
- }
53
+ }]);