eslint-plugin-nima 1.0.0 → 1.2.1
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/LICENSE +7 -0
- package/README.md +134 -1
- package/dist/constants/consoles.js +21 -1
- package/dist/constants/consoles.js.map +1 -1
- package/dist/index.d.ts +60 -86
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/models/boolean-naming-convention.model.d.ts +15 -0
- package/dist/models/boolean-naming-convention.model.js +11 -0
- package/dist/models/boolean-naming-convention.model.js.map +1 -0
- package/dist/models/no-handler-suffix.model.d.ts +4 -0
- package/dist/models/no-handler-suffix.model.js +8 -0
- package/dist/models/no-handler-suffix.model.js.map +1 -0
- package/dist/models/no-objects-in-deps.model.d.ts +4 -0
- package/dist/models/no-objects-in-deps.model.js +8 -0
- package/dist/models/no-objects-in-deps.model.js.map +1 -0
- package/dist/models/params-naming-convention.model.d.ts +11 -0
- package/dist/models/params-naming-convention.model.js +8 -0
- package/dist/models/params-naming-convention.model.js.map +1 -0
- package/dist/models/prefer-arrow-functions.model.d.ts +15 -0
- package/dist/models/prefer-arrow-functions.model.js +10 -0
- package/dist/models/prefer-arrow-functions.model.js.map +1 -0
- package/dist/models/prefer-export-under-component.model.d.ts +9 -0
- package/dist/models/prefer-export-under-component.model.js +8 -0
- package/dist/models/prefer-export-under-component.model.js.map +1 -0
- package/dist/models/prefer-react-fc.model.d.ts +9 -0
- package/dist/models/prefer-react-fc.model.js +8 -0
- package/dist/models/prefer-react-fc.model.js.map +1 -0
- package/dist/models/prefer-react-with-hooks.model.d.ts +5 -0
- package/dist/models/prefer-react-with-hooks.model.js +9 -0
- package/dist/models/prefer-react-with-hooks.model.js.map +1 -0
- package/dist/models/restrict-console-methods.model.d.ts +8 -0
- package/dist/models/restrict-console-methods.model.js +8 -0
- package/dist/models/restrict-console-methods.model.js.map +1 -0
- package/dist/models/restrict-function-usage.model.d.ts +11 -0
- package/dist/models/restrict-function-usage.model.js +8 -0
- package/dist/models/restrict-function-usage.model.js.map +1 -0
- package/dist/rules/boolean-naming-convention.d.ts +4 -8
- package/dist/rules/boolean-naming-convention.js +87 -35
- package/dist/rules/boolean-naming-convention.js.map +1 -1
- package/dist/rules/no-handler-suffix.d.ts +4 -2
- package/dist/rules/no-handler-suffix.js +13 -8
- package/dist/rules/no-handler-suffix.js.map +1 -1
- package/dist/rules/no-objects-in-deps.d.ts +4 -2
- package/dist/rules/no-objects-in-deps.js +21 -14
- package/dist/rules/no-objects-in-deps.js.map +1 -1
- package/dist/rules/params-naming-convention.d.ts +4 -7
- package/dist/rules/params-naming-convention.js +30 -30
- package/dist/rules/params-naming-convention.js.map +1 -1
- package/dist/rules/prefer-arrow-functions.d.ts +4 -9
- package/dist/rules/prefer-arrow-functions.js +37 -34
- package/dist/rules/prefer-arrow-functions.js.map +1 -1
- package/dist/rules/prefer-export-under-component.d.ts +5 -0
- package/dist/rules/prefer-export-under-component.js +115 -0
- package/dist/rules/prefer-export-under-component.js.map +1 -0
- package/dist/rules/prefer-react-fc.d.ts +4 -5
- package/dist/rules/prefer-react-fc.js +26 -27
- package/dist/rules/prefer-react-fc.js.map +1 -1
- package/dist/rules/prefer-react-with-hooks.d.ts +4 -4
- package/dist/rules/prefer-react-with-hooks.js +57 -41
- package/dist/rules/prefer-react-with-hooks.js.map +1 -1
- package/dist/rules/restrict-console-methods.d.ts +4 -8
- package/dist/rules/restrict-console-methods.js +20 -29
- package/dist/rules/restrict-console-methods.js.map +1 -1
- package/dist/rules/restrict-function-usage.d.ts +5 -0
- package/dist/rules/{manage-functions.js → restrict-function-usage.js} +24 -41
- package/dist/rules/restrict-function-usage.js.map +1 -0
- package/dist/utility/core.d.ts +6 -0
- package/dist/utility/core.js +6 -0
- package/dist/utility/core.js.map +1 -0
- package/dist/utility/function-helpers.d.ts +9 -0
- package/dist/utility/function-helpers.js +146 -0
- package/dist/utility/function-helpers.js.map +1 -0
- package/dist/utility/type-helpers.d.ts +2 -0
- package/dist/utility/{getType.js → type-helpers.js} +2 -2
- package/dist/utility/type-helpers.js.map +1 -0
- package/package.json +32 -17
- package/dist/rules/manage-functions.d.ts +0 -12
- package/dist/rules/manage-functions.js.map +0 -1
- package/dist/utility/getFunctionName.d.ts +0 -2
- package/dist/utility/getFunctionName.js +0 -36
- package/dist/utility/getFunctionName.js.map +0 -1
- package/dist/utility/getType.d.ts +0 -3
- package/dist/utility/getType.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2025 NIMA Labs
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1 +1,134 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/eslint-plugin-nima)
|
|
4
|
+
[](https://github.com/NIMA-Enterprises/eslint-plugin-nima/actions/workflows/publish.yml)
|
|
5
|
+
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
An **ESLint plugin** that enforces conventions, prevents common mistakes, and speeds up code reviews at NIMA.
|
|
9
|
+
It includes opinionated rules for naming, React, parameters, and restrictions on unsafe patterns.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Table of Contents
|
|
14
|
+
|
|
15
|
+
- [Installation](#installation)
|
|
16
|
+
- [Usage](#usage)
|
|
17
|
+
- [Recommended setup](#recommended-setup)
|
|
18
|
+
- [Custom setup](#custom-setup)
|
|
19
|
+
- [Rules](#rules)
|
|
20
|
+
- [Contributing](#contributing)
|
|
21
|
+
- [License](#license)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
First, install [ESLint](http://eslint.org):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm add -D eslint
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Then install `eslint-plugin-nima`:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pnpm add -D eslint-plugin-nima
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> **Note**: Don’t install ESLint globally. Keep it project-local for consistent results.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
You can enable this plugin in two ways: using the **recommended setup** or a **custom setup**.
|
|
46
|
+
|
|
47
|
+
### Recommended setup
|
|
48
|
+
|
|
49
|
+
Add the following to your `eslint.config.js`:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
import pluginNIMA from "eslint-plugin-nima";
|
|
53
|
+
|
|
54
|
+
export default [
|
|
55
|
+
pluginNIMA.configs["flat/recommended"],
|
|
56
|
+
// Any other config...
|
|
57
|
+
];
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
This enables the recommended set of rules we’ve curated for most NIMA projects.
|
|
61
|
+
|
|
62
|
+
### Custom setup
|
|
63
|
+
|
|
64
|
+
If you prefer to configure rules manually, load the plugin and specify only the rules you want:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import pluginNIMA from "eslint-plugin-nima";
|
|
68
|
+
|
|
69
|
+
export default [
|
|
70
|
+
{
|
|
71
|
+
plugins: {
|
|
72
|
+
nima: pluginNIMA,
|
|
73
|
+
},
|
|
74
|
+
rules: {
|
|
75
|
+
"nima/restrict-console-methods": "error",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
You can also extend the recommended config and override specific rules:
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
import pluginNIMA from "eslint-plugin-nima";
|
|
85
|
+
|
|
86
|
+
export default [
|
|
87
|
+
{
|
|
88
|
+
...pluginNIMA.configs["flat/recommended"],
|
|
89
|
+
rules: {
|
|
90
|
+
...pluginNIMA.configs["flat/recommended"].rules,
|
|
91
|
+
"nima/restrict-console-methods": "off",
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Rules
|
|
100
|
+
|
|
101
|
+
Each rule has three levels of explanation:
|
|
102
|
+
|
|
103
|
+
- **Short**: one-liner summary (good for quick scanning).
|
|
104
|
+
- **Medium**: sentences with examples (on the overview page).
|
|
105
|
+
- **Full**: dedicated docs per rule.
|
|
106
|
+
|
|
107
|
+
Before diving deep into what each rule does, I recommend reading the [Rule Overview Page](documentation/rules/index.md) where you can read a little bit about each rule and then you can see which one you want to dig into.
|
|
108
|
+
|
|
109
|
+
The plugin currently provides these rules:
|
|
110
|
+
|
|
111
|
+
- [no-handler-suffix](documentation/rules/no-handler-suffix.md)
|
|
112
|
+
- [restrict-console-methods](documentation/rules/restrict-console-methods.md)
|
|
113
|
+
- [prefer-export-under-component](documentation/rules/prefer-export-under-component.md)
|
|
114
|
+
- [prefer-react-fc](documentation/rules/prefer-react-fc.md)
|
|
115
|
+
- [prefer-arrow-functions](documentation/rules/prefer-arrow-functions.md)
|
|
116
|
+
- [prefer-react-with-hooks](documentation/rules/prefer-react-with-hooks.md)
|
|
117
|
+
- [restrict-function-usage](documentation/rules/restrict-function-usage.md)
|
|
118
|
+
- [no-objects-in-deps](documentation/rules/no-objects-in-deps.md)
|
|
119
|
+
- [params-naming-convention](documentation/rules/params-naming-convention.md)
|
|
120
|
+
- [boolean-naming-convention](documentation/rules/boolean-naming-convention.md)
|
|
121
|
+
|
|
122
|
+
See the full [Rules overview](documentation/rules/index.md).
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Configurations
|
|
127
|
+
|
|
128
|
+
There's also pre-built configurations:
|
|
129
|
+
|
|
130
|
+
- [recommended](documentation/configs/index.md)
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
[MIT](LICENSE)
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CONSOLES = void 0;
|
|
4
|
-
exports.CONSOLES = new Set([
|
|
4
|
+
exports.CONSOLES = new Set([
|
|
5
|
+
"assert",
|
|
6
|
+
"clear",
|
|
7
|
+
"count",
|
|
8
|
+
"countReset",
|
|
9
|
+
"debug",
|
|
10
|
+
"dir",
|
|
11
|
+
"dirxml",
|
|
12
|
+
"error",
|
|
13
|
+
"group",
|
|
14
|
+
"groupEnd",
|
|
15
|
+
"info",
|
|
16
|
+
"log",
|
|
17
|
+
"profile",
|
|
18
|
+
"profileEnd",
|
|
19
|
+
"table",
|
|
20
|
+
"time",
|
|
21
|
+
"timeEnd",
|
|
22
|
+
"trace",
|
|
23
|
+
"warn",
|
|
24
|
+
]);
|
|
5
25
|
//# sourceMappingURL=consoles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consoles.js","sourceRoot":"","sources":["../../src/constants/consoles.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,IAAI,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"consoles.js","sourceRoot":"","sources":["../../src/constants/consoles.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,IAAI,GAAG,CAAC;IAC9B,QAAQ;IACR,OAAO;IACP,OAAO;IACP,YAAY;IACZ,OAAO;IACP,KAAK;IACL,QAAQ;IACR,OAAO;IACP,OAAO;IACP,UAAU;IACV,MAAM;IACN,KAAK;IACL,SAAS;IACT,YAAY;IACZ,OAAO;IACP,MAAM;IACN,SAAS;IACT,OAAO;IACP,MAAM;CACP,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,49 +1,36 @@
|
|
|
1
1
|
import type { RuleModule } from "@typescript-eslint/utils/ts-eslint";
|
|
2
2
|
import type { ESLint, Linter } from "eslint";
|
|
3
3
|
declare const rules: {
|
|
4
|
-
"boolean-naming-convention": RuleModule<"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
35
|
-
"prefer-react-fc": RuleModule<"requireReactFC", [{
|
|
36
|
-
allowArrowFunctions: boolean;
|
|
37
|
-
allowFunctionDeclarations: boolean;
|
|
38
|
-
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
39
|
-
"prefer-react-with-hooks": RuleModule<"preferReact" | "preferReactPrefix", [{
|
|
40
|
-
autoFix: boolean;
|
|
41
|
-
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
42
|
-
"restrict-console-methods": RuleModule<"noConsole", {
|
|
43
|
-
noConsoleError?: boolean;
|
|
44
|
-
noConsoleLog?: boolean;
|
|
45
|
-
noConsoleWarn?: boolean;
|
|
46
|
-
}[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
4
|
+
"boolean-naming-convention": RuleModule<import("./models/boolean-naming-convention.model").Messages, import("./models/boolean-naming-convention.model").Options, {
|
|
5
|
+
recommended: boolean;
|
|
6
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
7
|
+
"restrict-function-usage": RuleModule<import("./models/restrict-function-usage.model").Messages, import("./models/restrict-function-usage.model").Options, {
|
|
8
|
+
recommended: boolean;
|
|
9
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
10
|
+
"no-handler-suffix": RuleModule<import("./models/no-handler-suffix.model").Messages, [], {
|
|
11
|
+
recommended: boolean;
|
|
12
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
13
|
+
"no-objects-in-deps": RuleModule<import("./models/no-objects-in-deps.model").Messages, [], {
|
|
14
|
+
recommended: boolean;
|
|
15
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
16
|
+
"params-naming-convention": RuleModule<import("./models/params-naming-convention.model").Messages, import("./models/params-naming-convention.model").Options, {
|
|
17
|
+
recommended: boolean;
|
|
18
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
19
|
+
"prefer-arrow-functions": RuleModule<import("./models/prefer-arrow-functions.model").Messages, import("./models/prefer-arrow-functions.model").Options, {
|
|
20
|
+
recommended: boolean;
|
|
21
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
22
|
+
"prefer-export-under-component": RuleModule<import("./models/prefer-export-under-component.model").Messages, import("./models/prefer-export-under-component.model").Options, {
|
|
23
|
+
recommended: boolean;
|
|
24
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
25
|
+
"prefer-react-fc": RuleModule<import("./models/prefer-react-fc.model").Messages, import("./models/prefer-react-fc.model").Options, {
|
|
26
|
+
recommended: boolean;
|
|
27
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
28
|
+
"prefer-react-with-hooks": RuleModule<import("./models/prefer-react-with-hooks.model").Messages, [], {
|
|
29
|
+
recommended: boolean;
|
|
30
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
31
|
+
"restrict-console-methods": RuleModule<import("./models/restrict-console-methods.model").Messages, import("./models/restrict-console-methods.model").Options, {
|
|
32
|
+
recommended: boolean;
|
|
33
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
47
34
|
};
|
|
48
35
|
interface Plugin extends Omit<ESLint.Plugin, "rules"> {
|
|
49
36
|
configs: {
|
|
@@ -59,49 +46,36 @@ declare const plugin: {
|
|
|
59
46
|
name: string;
|
|
60
47
|
};
|
|
61
48
|
rules: {
|
|
62
|
-
"boolean-naming-convention": RuleModule<"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
93
|
-
"prefer-react-fc": RuleModule<"requireReactFC", [{
|
|
94
|
-
allowArrowFunctions: boolean;
|
|
95
|
-
allowFunctionDeclarations: boolean;
|
|
96
|
-
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
97
|
-
"prefer-react-with-hooks": RuleModule<"preferReact" | "preferReactPrefix", [{
|
|
98
|
-
autoFix: boolean;
|
|
99
|
-
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
100
|
-
"restrict-console-methods": RuleModule<"noConsole", {
|
|
101
|
-
noConsoleError?: boolean;
|
|
102
|
-
noConsoleLog?: boolean;
|
|
103
|
-
noConsoleWarn?: boolean;
|
|
104
|
-
}[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
49
|
+
"boolean-naming-convention": RuleModule<import("./models/boolean-naming-convention.model").Messages, import("./models/boolean-naming-convention.model").Options, {
|
|
50
|
+
recommended: boolean;
|
|
51
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
52
|
+
"restrict-function-usage": RuleModule<import("./models/restrict-function-usage.model").Messages, import("./models/restrict-function-usage.model").Options, {
|
|
53
|
+
recommended: boolean;
|
|
54
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
55
|
+
"no-handler-suffix": RuleModule<import("./models/no-handler-suffix.model").Messages, [], {
|
|
56
|
+
recommended: boolean;
|
|
57
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
58
|
+
"no-objects-in-deps": RuleModule<import("./models/no-objects-in-deps.model").Messages, [], {
|
|
59
|
+
recommended: boolean;
|
|
60
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
61
|
+
"params-naming-convention": RuleModule<import("./models/params-naming-convention.model").Messages, import("./models/params-naming-convention.model").Options, {
|
|
62
|
+
recommended: boolean;
|
|
63
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
64
|
+
"prefer-arrow-functions": RuleModule<import("./models/prefer-arrow-functions.model").Messages, import("./models/prefer-arrow-functions.model").Options, {
|
|
65
|
+
recommended: boolean;
|
|
66
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
67
|
+
"prefer-export-under-component": RuleModule<import("./models/prefer-export-under-component.model").Messages, import("./models/prefer-export-under-component.model").Options, {
|
|
68
|
+
recommended: boolean;
|
|
69
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
70
|
+
"prefer-react-fc": RuleModule<import("./models/prefer-react-fc.model").Messages, import("./models/prefer-react-fc.model").Options, {
|
|
71
|
+
recommended: boolean;
|
|
72
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
73
|
+
"prefer-react-with-hooks": RuleModule<import("./models/prefer-react-with-hooks.model").Messages, [], {
|
|
74
|
+
recommended: boolean;
|
|
75
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
76
|
+
"restrict-console-methods": RuleModule<import("./models/restrict-console-methods.model").Messages, import("./models/restrict-console-methods.model").Options, {
|
|
77
|
+
recommended: boolean;
|
|
78
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
105
79
|
};
|
|
106
80
|
};
|
|
107
81
|
export = plugin;
|
package/dist/index.js
CHANGED
|
@@ -33,14 +33,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
const BooleanNamingConvention = __importStar(require("./rules/boolean-naming-convention"));
|
|
36
|
-
const ManageFunctions = __importStar(require("./rules/manage-functions"));
|
|
37
36
|
const NoHandlerSuffix = __importStar(require("./rules/no-handler-suffix"));
|
|
38
37
|
const NoObjectsInDeps = __importStar(require("./rules/no-objects-in-deps"));
|
|
39
38
|
const ParamsNamingConvention = __importStar(require("./rules/params-naming-convention"));
|
|
40
39
|
const PreferArrowFunctions = __importStar(require("./rules/prefer-arrow-functions"));
|
|
40
|
+
const PreferNamedExport = __importStar(require("./rules/prefer-export-under-component"));
|
|
41
41
|
const PreferReactFc = __importStar(require("./rules/prefer-react-fc"));
|
|
42
42
|
const PreferReactWithHooks = __importStar(require("./rules/prefer-react-with-hooks"));
|
|
43
43
|
const RestrictConsoleMethods = __importStar(require("./rules/restrict-console-methods"));
|
|
44
|
+
const ManageFunctions = __importStar(require("./rules/restrict-function-usage"));
|
|
44
45
|
const rules = {
|
|
45
46
|
[BooleanNamingConvention.name]: BooleanNamingConvention.rule,
|
|
46
47
|
[ManageFunctions.name]: ManageFunctions.rule,
|
|
@@ -48,6 +49,7 @@ const rules = {
|
|
|
48
49
|
[NoObjectsInDeps.name]: NoObjectsInDeps.rule,
|
|
49
50
|
[ParamsNamingConvention.name]: ParamsNamingConvention.rule,
|
|
50
51
|
[PreferArrowFunctions.name]: PreferArrowFunctions.rule,
|
|
52
|
+
[PreferNamedExport.name]: PreferNamedExport.rule,
|
|
51
53
|
[PreferReactFc.name]: PreferReactFc.rule,
|
|
52
54
|
[PreferReactWithHooks.name]: PreferReactWithHooks.rule,
|
|
53
55
|
[RestrictConsoleMethods.name]: RestrictConsoleMethods.rule,
|
|
@@ -61,6 +63,7 @@ const plugin = {
|
|
|
61
63
|
};
|
|
62
64
|
const recommended = {
|
|
63
65
|
"nima/no-handler-suffix": "error",
|
|
66
|
+
"nima/prefer-export-under-component": "error",
|
|
64
67
|
"nima/prefer-react-fc": "warn",
|
|
65
68
|
"nima/restrict-console-methods": "error",
|
|
66
69
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,0FAA4E;AAC5E,0EAA4D;AAC5D,2EAA6D;AAC7D,wFAA0E;AAC1E,oFAAsE;AACtE,wFAA0E;AAC1E,sEAAwD;AACxD,qFAAuE;AACvE,wFAA0E;AAC1E,gFAAkE;AAElE,MAAM,KAAK,GAAG;IACZ,CAAC,uBAAuB,CAAC,IAAI,CAAC,EAAE,uBAAuB,CAAC,IAAI;IAC5D,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC,IAAI;IAC5C,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC,IAAI;IAC5C,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC,IAAI;IAC5C,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,sBAAsB,CAAC,IAAI;IAC1D,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,oBAAoB,CAAC,IAAI;IACtD,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAC,IAAI;IAChD,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC,IAAI;IACxC,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,oBAAoB,CAAC,IAAI;IACtD,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,sBAAsB,CAAC,IAAI;CAC3D,CAAC;AAYF,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,EAAuB;IAEhC,IAAI,EAAE;QACJ,IAAI,EAAE,oBAAoB;KAC3B;IAED,KAAK;CACN,CAAC;AAEF,MAAM,WAAW,GAEb;IACF,wBAAwB,EAAE,OAAO;IACjC,oCAAoC,EAAE,OAAO;IAC7C,sBAAsB,EAAE,MAAM;IAC9B,+BAA+B,EAAE,OAAO;CACzC,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;IAC5B,kBAAkB,EAAE;QAClB,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;SACb;QACD,KAAK,EAAE,WAAW;KACnB;IACD,WAAW,EAAE;QACX,OAAO,EAAE,CAAC,MAAM,CAAC;QACjB,KAAK,EAAE,WAAW;KACnB;CACF,CAAC,CAAC;AAEH,iBAAS,MAAM,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const enum Messages {
|
|
2
|
+
BAD_FUNCTION_BOOLEAN_PREFIX = "BAD_FUNCTION_BOOLEAN_PREFIX",
|
|
3
|
+
BAD_PARAMETER_BOOLEAN_PREFIX = "BAD_PARAMETER_BOOLEAN_PREFIX",
|
|
4
|
+
BAD_PROPERTY_BOOLEAN_PREFIX = "BAD_PROPERTY_BOOLEAN_PREFIX",
|
|
5
|
+
BAD_VARIABLE_BOOLEAN_PREFIX = "BAD_VARIABLE_BOOLEAN_PREFIX"
|
|
6
|
+
}
|
|
7
|
+
export type Options = [
|
|
8
|
+
Partial<{
|
|
9
|
+
allowedPrefixes: string[];
|
|
10
|
+
checkFunctions: boolean;
|
|
11
|
+
checkParameters: boolean;
|
|
12
|
+
checkProperties: boolean;
|
|
13
|
+
checkVariables: boolean;
|
|
14
|
+
}>
|
|
15
|
+
];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Messages = void 0;
|
|
4
|
+
var Messages;
|
|
5
|
+
(function (Messages) {
|
|
6
|
+
Messages["BAD_FUNCTION_BOOLEAN_PREFIX"] = "BAD_FUNCTION_BOOLEAN_PREFIX";
|
|
7
|
+
Messages["BAD_PARAMETER_BOOLEAN_PREFIX"] = "BAD_PARAMETER_BOOLEAN_PREFIX";
|
|
8
|
+
Messages["BAD_PROPERTY_BOOLEAN_PREFIX"] = "BAD_PROPERTY_BOOLEAN_PREFIX";
|
|
9
|
+
Messages["BAD_VARIABLE_BOOLEAN_PREFIX"] = "BAD_VARIABLE_BOOLEAN_PREFIX";
|
|
10
|
+
})(Messages || (exports.Messages = Messages = {}));
|
|
11
|
+
//# sourceMappingURL=boolean-naming-convention.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean-naming-convention.model.js","sourceRoot":"","sources":["../../src/models/boolean-naming-convention.model.ts"],"names":[],"mappings":";;;AAAA,IAAkB,QAKjB;AALD,WAAkB,QAAQ;IACxB,uEAA2D,CAAA;IAC3D,yEAA6D,CAAA;IAC7D,uEAA2D,CAAA;IAC3D,uEAA2D,CAAA;AAC7D,CAAC,EALiB,QAAQ,wBAAR,QAAQ,QAKzB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Messages = void 0;
|
|
4
|
+
var Messages;
|
|
5
|
+
(function (Messages) {
|
|
6
|
+
Messages["BAD_HANDLER_NAME"] = "BAD_HANDLER_NAME";
|
|
7
|
+
})(Messages || (exports.Messages = Messages = {}));
|
|
8
|
+
//# sourceMappingURL=no-handler-suffix.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-handler-suffix.model.js","sourceRoot":"","sources":["../../src/models/no-handler-suffix.model.ts"],"names":[],"mappings":";;;AAAA,IAAkB,QAEjB;AAFD,WAAkB,QAAQ;IACxB,iDAAqC,CAAA;AACvC,CAAC,EAFiB,QAAQ,wBAAR,QAAQ,QAEzB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Messages = void 0;
|
|
4
|
+
var Messages;
|
|
5
|
+
(function (Messages) {
|
|
6
|
+
Messages["NO_OBJECTS_IN_DEPENDENCIES"] = "NO_OBJECTS_IN_DEPENDENCIES";
|
|
7
|
+
})(Messages || (exports.Messages = Messages = {}));
|
|
8
|
+
//# sourceMappingURL=no-objects-in-deps.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-objects-in-deps.model.js","sourceRoot":"","sources":["../../src/models/no-objects-in-deps.model.ts"],"names":[],"mappings":";;;AAAA,IAAkB,QAEjB;AAFD,WAAkB,QAAQ;IACxB,qEAAyD,CAAA;AAC3D,CAAC,EAFiB,QAAQ,wBAAR,QAAQ,QAEzB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Messages = void 0;
|
|
4
|
+
var Messages;
|
|
5
|
+
(function (Messages) {
|
|
6
|
+
Messages["USE_OBJECT_PARAMETERS"] = "USE_OBJECT_PARAMETERS";
|
|
7
|
+
})(Messages || (exports.Messages = Messages = {}));
|
|
8
|
+
//# sourceMappingURL=params-naming-convention.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"params-naming-convention.model.js","sourceRoot":"","sources":["../../src/models/params-naming-convention.model.ts"],"names":[],"mappings":";;;AAAA,IAAkB,QAEjB;AAFD,WAAkB,QAAQ;IACxB,2DAA+C,CAAA;AACjD,CAAC,EAFiB,QAAQ,wBAAR,QAAQ,QAEzB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const enum Messages {
|
|
2
|
+
PREFER_ARROW_FUNCTION_EXPRESSION = "PREFER_ARROW_FUNCTION_EXPRESSION",
|
|
3
|
+
PREFER_ARROW_FUNCTIONS = "PREFER_ARROW_FUNCTIONS",
|
|
4
|
+
PREFER_ARROW_METHOD = "PREFER_ARROW_METHOD"
|
|
5
|
+
}
|
|
6
|
+
export type Options = [
|
|
7
|
+
Partial<{
|
|
8
|
+
allowAsync: boolean;
|
|
9
|
+
allowConstructors: boolean;
|
|
10
|
+
allowFunctionDeclarations: boolean;
|
|
11
|
+
allowFunctionExpressions: boolean;
|
|
12
|
+
allowGenerators: boolean;
|
|
13
|
+
allowMethodDefinitions: boolean;
|
|
14
|
+
}>
|
|
15
|
+
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Messages = void 0;
|
|
4
|
+
var Messages;
|
|
5
|
+
(function (Messages) {
|
|
6
|
+
Messages["PREFER_ARROW_FUNCTION_EXPRESSION"] = "PREFER_ARROW_FUNCTION_EXPRESSION";
|
|
7
|
+
Messages["PREFER_ARROW_FUNCTIONS"] = "PREFER_ARROW_FUNCTIONS";
|
|
8
|
+
Messages["PREFER_ARROW_METHOD"] = "PREFER_ARROW_METHOD";
|
|
9
|
+
})(Messages || (exports.Messages = Messages = {}));
|
|
10
|
+
//# sourceMappingURL=prefer-arrow-functions.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-arrow-functions.model.js","sourceRoot":"","sources":["../../src/models/prefer-arrow-functions.model.ts"],"names":[],"mappings":";;;AAAA,IAAkB,QAIjB;AAJD,WAAkB,QAAQ;IACxB,iFAAqE,CAAA;IACrE,6DAAiD,CAAA;IACjD,uDAA2C,CAAA;AAC7C,CAAC,EAJiB,QAAQ,wBAAR,QAAQ,QAIzB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Messages = void 0;
|
|
4
|
+
var Messages;
|
|
5
|
+
(function (Messages) {
|
|
6
|
+
Messages["EXPORT_BELOW_COMPONENT"] = "EXPORT_BELOW_COMPONENT";
|
|
7
|
+
})(Messages || (exports.Messages = Messages = {}));
|
|
8
|
+
//# sourceMappingURL=prefer-export-under-component.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-export-under-component.model.js","sourceRoot":"","sources":["../../src/models/prefer-export-under-component.model.ts"],"names":[],"mappings":";;;AAAA,IAAkB,QAEjB;AAFD,WAAkB,QAAQ;IACxB,6DAAiD,CAAA;AACnD,CAAC,EAFiB,QAAQ,wBAAR,QAAQ,QAEzB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Messages = void 0;
|
|
4
|
+
var Messages;
|
|
5
|
+
(function (Messages) {
|
|
6
|
+
Messages["REQUIRE_REACT_FC"] = "REQUIRE_REACT_FC";
|
|
7
|
+
})(Messages || (exports.Messages = Messages = {}));
|
|
8
|
+
//# sourceMappingURL=prefer-react-fc.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-react-fc.model.js","sourceRoot":"","sources":["../../src/models/prefer-react-fc.model.ts"],"names":[],"mappings":";;;AAAA,IAAkB,QAEjB;AAFD,WAAkB,QAAQ;IACxB,iDAAqC,CAAA;AACvC,CAAC,EAFiB,QAAQ,wBAAR,QAAQ,QAEzB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Messages = void 0;
|
|
4
|
+
var Messages;
|
|
5
|
+
(function (Messages) {
|
|
6
|
+
Messages["PREFER_REACT"] = "PREFER_REACT";
|
|
7
|
+
Messages["PREFER_REACT_PREFIX"] = "PREFER_REACT_PREFIX";
|
|
8
|
+
})(Messages || (exports.Messages = Messages = {}));
|
|
9
|
+
//# sourceMappingURL=prefer-react-with-hooks.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-react-with-hooks.model.js","sourceRoot":"","sources":["../../src/models/prefer-react-with-hooks.model.ts"],"names":[],"mappings":";;;AAAA,IAAkB,QAGjB;AAHD,WAAkB,QAAQ;IACxB,yCAA6B,CAAA;IAC7B,uDAA2C,CAAA;AAC7C,CAAC,EAHiB,QAAQ,wBAAR,QAAQ,QAGzB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Messages = void 0;
|
|
4
|
+
var Messages;
|
|
5
|
+
(function (Messages) {
|
|
6
|
+
Messages["NO_CONSOLE"] = "NO_CONSOLE";
|
|
7
|
+
})(Messages || (exports.Messages = Messages = {}));
|
|
8
|
+
//# sourceMappingURL=restrict-console-methods.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restrict-console-methods.model.js","sourceRoot":"","sources":["../../src/models/restrict-console-methods.model.ts"],"names":[],"mappings":";;;AAAA,IAAkB,QAEjB;AAFD,WAAkB,QAAQ;IACxB,qCAAyB,CAAA;AAC3B,CAAC,EAFiB,QAAQ,wBAAR,QAAQ,QAEzB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Messages = void 0;
|
|
4
|
+
var Messages;
|
|
5
|
+
(function (Messages) {
|
|
6
|
+
Messages["FUNCTION_DISALLOWED"] = "FUNCTION_DISALLOWED";
|
|
7
|
+
})(Messages || (exports.Messages = Messages = {}));
|
|
8
|
+
//# sourceMappingURL=restrict-function-usage.model.js.map
|