eslint-plugin-turbo 2.2.4-canary.9 → 2.3.1-canary.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # `eslint-plugin-turbo`
2
2
 
3
- Ease configuration for Turborepo
3
+ Easy ESLint configuration for Turborepo
4
4
 
5
5
  ## Installation
6
6
 
@@ -16,7 +16,7 @@ npm install eslint --save-dev
16
16
  npm install eslint-plugin-turbo --save-dev
17
17
  ```
18
18
 
19
- ## Usage
19
+ ## Usage (Legacy `eslintrc*`)
20
20
 
21
21
  Add `turbo` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
22
22
 
@@ -36,7 +36,7 @@ Then configure the rules you want to use under the rules section.
36
36
  }
37
37
  ```
38
38
 
39
- ### Example
39
+ ## Example (Legacy `eslintrc*`)
40
40
 
41
41
  ```json
42
42
  {
@@ -51,3 +51,52 @@ Then configure the rules you want to use under the rules section.
51
51
  }
52
52
  }
53
53
  ```
54
+
55
+ ## Usage (Flat Config `eslint.config.js`)
56
+
57
+ In ESLint v8, both the legacy system and the new flat config system are supported. In ESLint v9, only the new system will be supported. See the [official ESLint docs](https://eslint.org/docs/latest/use/configure/configuration-files).
58
+
59
+ ```js
60
+ import turbo from "eslint-plugin-turbo";
61
+
62
+ export default [turbo.configs["flat/recommended"]];
63
+ ```
64
+
65
+ Otherwise, you may configure the rules you want to use under the rules section.
66
+
67
+ ```js
68
+ import turbo from "eslint-plugin-turbo";
69
+
70
+ export default [
71
+ {
72
+ plugins: {
73
+ turbo,
74
+ },
75
+ rules: {
76
+ "turbo/no-undeclared-env-vars": "error",
77
+ },
78
+ },
79
+ ];
80
+ ```
81
+
82
+ ## Example (Flat Config `eslint.config.js`)
83
+
84
+ ```js
85
+ import turbo from "eslint-plugin-turbo";
86
+
87
+ export default [
88
+ {
89
+ plugins: {
90
+ turbo,
91
+ },
92
+ rules: {
93
+ "turbo/no-undeclared-env-vars": [
94
+ "error",
95
+ {
96
+ allowList: ["^ENV_[A-Z]+$"],
97
+ },
98
+ ],
99
+ },
100
+ },
101
+ ];
102
+ ```
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as eslint from 'eslint';
2
- import { Rule } from 'eslint';
2
+ import { Rule, ESLint } from 'eslint';
3
3
 
4
4
  interface EnvironmentConfig {
5
5
  legacyConfig: Array<string>;
@@ -24,6 +24,44 @@ interface RuleContextWithOptions extends Rule.RuleContext {
24
24
  }>;
25
25
  }
26
26
 
27
+ declare const plugin: {
28
+ meta: {
29
+ name: string;
30
+ version: string;
31
+ };
32
+ rules: {
33
+ [x: string]: {
34
+ create: (context: RuleContextWithOptions) => eslint.Rule.RuleListener;
35
+ meta: eslint.Rule.RuleMetaData;
36
+ };
37
+ };
38
+ configs: {
39
+ recommended: {
40
+ settings: {
41
+ turbo: {
42
+ cacheKey: number | ProjectKey;
43
+ };
44
+ };
45
+ plugins: string[];
46
+ rules: {
47
+ [x: string]: "error";
48
+ };
49
+ };
50
+ "flat/recommended": {
51
+ plugins: {
52
+ readonly turbo: ESLint.Plugin;
53
+ };
54
+ rules: {
55
+ [x: string]: "error";
56
+ };
57
+ settings: {
58
+ turbo: {
59
+ cacheKey: number | ProjectKey;
60
+ };
61
+ };
62
+ };
63
+ };
64
+ };
27
65
  declare const rules: {
28
66
  [x: string]: {
29
67
  create: (context: RuleContextWithOptions) => eslint.Rule.RuleListener;
@@ -39,9 +77,22 @@ declare const configs: {
39
77
  };
40
78
  plugins: string[];
41
79
  rules: {
42
- [x: string]: string;
80
+ [x: string]: "error";
81
+ };
82
+ };
83
+ "flat/recommended": {
84
+ plugins: {
85
+ readonly turbo: ESLint.Plugin;
86
+ };
87
+ rules: {
88
+ [x: string]: "error";
89
+ };
90
+ settings: {
91
+ turbo: {
92
+ cacheKey: number | ProjectKey;
93
+ };
43
94
  };
44
95
  };
45
96
  };
46
97
 
47
- export { configs, rules };
98
+ export { configs, plugin as default, rules };