eslint-plugin-big-react-app-plugin 0.0.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/.eslintrc.js +19 -0
- package/README.md +46 -0
- package/docs/rules/path-checker.md +35 -0
- package/lib/index.js +22 -0
- package/lib/rules/path-checker.js +24 -0
- package/package.json +32 -0
- package/tests/lib/rules/path-checker.js +31 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
root: true,
|
|
5
|
+
extends: [
|
|
6
|
+
"eslint:recommended",
|
|
7
|
+
"plugin:eslint-plugin/recommended",
|
|
8
|
+
"plugin:node/recommended",
|
|
9
|
+
],
|
|
10
|
+
env: {
|
|
11
|
+
node: true,
|
|
12
|
+
},
|
|
13
|
+
overrides: [
|
|
14
|
+
{
|
|
15
|
+
files: ["tests/**/*.js"],
|
|
16
|
+
env: { mocha: true },
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
};
|
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# eslint-plugin-big-react-app-plugin
|
|
2
|
+
|
|
3
|
+
plugin for prod proj
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
You'll first need to install [ESLint](https://eslint.org/):
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm i eslint --save-dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Next, install `eslint-plugin-big-react-app-plugin`:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install eslint-plugin-big-react-app-plugin --save-dev
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Add `big-react-app-plugin` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"plugins": [
|
|
26
|
+
"big-react-app-plugin"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
Then configure the rules you want to use under the rules section.
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"rules": {
|
|
37
|
+
"big-react-app-plugin/rule-name": 2
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Supported Rules
|
|
43
|
+
|
|
44
|
+
* Fill in provided rules here
|
|
45
|
+
|
|
46
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# feature sliced relative path checker (path-checker)
|
|
2
|
+
|
|
3
|
+
Please describe the origin of the rule here.
|
|
4
|
+
|
|
5
|
+
## Rule Details
|
|
6
|
+
|
|
7
|
+
This rule aims to...
|
|
8
|
+
|
|
9
|
+
Examples of **incorrect** code for this rule:
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
|
|
13
|
+
// fill me in
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Examples of **correct** code for this rule:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
|
|
21
|
+
// fill me in
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Options
|
|
26
|
+
|
|
27
|
+
If there are any options, describe them here. Otherwise, delete this section.
|
|
28
|
+
|
|
29
|
+
## When Not To Use It
|
|
30
|
+
|
|
31
|
+
Give a short description of when it would be appropriate to turn off this rule.
|
|
32
|
+
|
|
33
|
+
## Further Reading
|
|
34
|
+
|
|
35
|
+
If there are other links that describe the issue this rule addresses, please include them here in a bulleted list.
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview plugin for prod proj
|
|
3
|
+
* @author Vasilii
|
|
4
|
+
*/
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
//------------------------------------------------------------------------------
|
|
8
|
+
// Requirements
|
|
9
|
+
//------------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
const requireIndex = require("requireindex");
|
|
12
|
+
|
|
13
|
+
//------------------------------------------------------------------------------
|
|
14
|
+
// Plugin Definition
|
|
15
|
+
//------------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
// import all rules in lib/rules
|
|
19
|
+
module.exports.rules = requireIndex(__dirname + "/rules");
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
module.exports = {
|
|
3
|
+
meta: {
|
|
4
|
+
type: null, // `problem`, `suggestion`, or `layout`
|
|
5
|
+
docs: {
|
|
6
|
+
description: "feature sliced relative path checker",
|
|
7
|
+
category: "Fill me in",
|
|
8
|
+
recommended: false,
|
|
9
|
+
url: null, // URL to the documentation page for this rule
|
|
10
|
+
},
|
|
11
|
+
fixable: null, // Or `code` or `whitespace`
|
|
12
|
+
schema: [], // Add a schema if the rule has options
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
create(context) {
|
|
16
|
+
return {
|
|
17
|
+
ImportDeclaration(node){
|
|
18
|
+
const importTo = node.source.value
|
|
19
|
+
const importFrom = context.getFilename()
|
|
20
|
+
context.report(node, "Линтер работает и ругается")
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eslint-plugin-big-react-app-plugin",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "plugin for prod proj",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eslint",
|
|
7
|
+
"eslintplugin",
|
|
8
|
+
"eslint-plugin"
|
|
9
|
+
],
|
|
10
|
+
"author": "Vasilii",
|
|
11
|
+
"main": "lib/index.js",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"lint": "eslint .",
|
|
14
|
+
"test": "mocha tests --recursive"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"requireindex": "^1.2.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"eslint": "^8.0.1",
|
|
21
|
+
"eslint-plugin-eslint-plugin": "^4.0.1",
|
|
22
|
+
"eslint-plugin-node": "^11.1.0",
|
|
23
|
+
"mocha": "^9.1.3"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": "12.x || 14.x || >= 16"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"eslint": ">=6"
|
|
30
|
+
},
|
|
31
|
+
"license": "ISC"
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview feature sliced relative path checker
|
|
3
|
+
* @author Vasilii
|
|
4
|
+
*/
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
//------------------------------------------------------------------------------
|
|
8
|
+
// Requirements
|
|
9
|
+
//------------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
const rule = require("../../../lib/rules/path-checker"),
|
|
12
|
+
RuleTester = require("eslint").RuleTester;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
//------------------------------------------------------------------------------
|
|
16
|
+
// Tests
|
|
17
|
+
//------------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
const ruleTester = new RuleTester();
|
|
20
|
+
ruleTester.run("path-checker", rule, {
|
|
21
|
+
valid: [
|
|
22
|
+
// give me some code that won't trigger a warning
|
|
23
|
+
],
|
|
24
|
+
|
|
25
|
+
invalid: [
|
|
26
|
+
{
|
|
27
|
+
code: "",
|
|
28
|
+
errors: [{ message: "Fill me in.", type: "Me too" }],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
});
|