@bigbinary/eslint-plugin-neeto 1.0.11
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 +149 -0
- package/dist/index.js +2225 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# eslint-plugin-neeto
|
|
2
|
+
|
|
3
|
+
An ESLint plugin for enforcing common front-end best practices specifically for
|
|
4
|
+
neeto.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
Install the plugin from npm:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
yarn add -D "@bigbinary/eslint-plugin-neeto@1.0.11"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
In your eslintrc.js file, add `neeto` in the `plugins` list and add the required
|
|
15
|
+
rules.
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
module.exports = {
|
|
19
|
+
// ...other configurations
|
|
20
|
+
plugins: [
|
|
21
|
+
// ...other plugins
|
|
22
|
+
"@bigbinary/neeto",
|
|
23
|
+
],
|
|
24
|
+
rules: {
|
|
25
|
+
"@bigbinary/neeto/ramda-tips": "warn",
|
|
26
|
+
// ...other rules
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Exported rules
|
|
32
|
+
|
|
33
|
+
- [api-connector-name-should-match-filename](./docs/src/rules/api-connector-name-should-match-filename.md)
|
|
34
|
+
- [api-connector-should-use-default-export](./docs/src/rules/api-connector-should-use-default-export.md)
|
|
35
|
+
- [combine-multiple-independent-awaits](./docs/src/rules/combine-multiple-independent-awaits.md)
|
|
36
|
+
- [no-blacklisted-imports](./docs/src/rules/no-blacklisted-imports.md)
|
|
37
|
+
- [no-axios-import-outside-apis](./docs/src/rules/no-axios-import-outside-apis.md)
|
|
38
|
+
- [no-dangling-constants](./docs/src/rules/no-dangling-constants.md)
|
|
39
|
+
- [no-dangling-functions](./docs/src/rules/no-dangling-functions.md)
|
|
40
|
+
- [no-excess-function-arguments](./docs/src/rules/no-excess-function-arguments.md)
|
|
41
|
+
- [no-globalProps-destructure](./docs/src/rules/no-globalProps-destructure.md)
|
|
42
|
+
- [no-globalProps-reassignment](./docs/src/rules/no-globalProps-reassignment.md)
|
|
43
|
+
- [no-missing-localization](./docs/src/rules/no-missing-localization.md)
|
|
44
|
+
- [no-namespace-specifier-import-for-ramda](./docs/src/rules/no-namespace-specifier-import-for-ramda.md)
|
|
45
|
+
- [no-redundant-jsx-expression](./docs/src/rules/no-redundant-jsx-expression.md)
|
|
46
|
+
- [no-redundant-string-templates](./docs/src/rules/no-redundant-string-templates.md)
|
|
47
|
+
- [prefix-neeto-ui-import-alias](./docs/src/rules/prefix-neeto-ui-import-alias.md)
|
|
48
|
+
- [ramda-tips](./docs/src/rules/ramda-tips.md)
|
|
49
|
+
- [use-axios-config-for-passing-query-parameters](./docs/src/rules/use-axios-config-for-passing-query-parameters.md)
|
|
50
|
+
- [use-constant-case](./docs/src/rules/use-constant-case.md)
|
|
51
|
+
- [use-snake-case-for-api-connector-filename](./docs/src/rules/use-snake-case-for-api-connector-filename.md)
|
|
52
|
+
- [use-webpack-alias](./docs/src/rules/use-webpack-alias.md)
|
|
53
|
+
|
|
54
|
+
## Development setup
|
|
55
|
+
|
|
56
|
+
### Initialization
|
|
57
|
+
|
|
58
|
+
Clone this repo and initialize it by running `yarn install`
|
|
59
|
+
|
|
60
|
+
### Creating new rules
|
|
61
|
+
|
|
62
|
+
You can use the script [`bin/generate-rule`](./bin/generate-rule) to scaffold a
|
|
63
|
+
new rule.
|
|
64
|
+
|
|
65
|
+
#### Usage:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
./bin/generate-rule <rule-name> [--description=<rule-description-inside-quotes>] [--type=<rule-type>] [-P]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### Examples:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
./bin/generate-rule "no-string-templates" --description="Disallows the use of string templates in JS" --type="suggestion"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`-D` is an alias for `--description`<br/> `-T` is an alias for `--type` You can
|
|
78
|
+
rewrite the same command as:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
./bin/generate-rule "no-string-templates" -D "Disallows the use of string templates in JS" -T "suggestion"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
If you don't need to generate a `constants.js` file for the rule, you can add
|
|
85
|
+
the `-C` (or `--without-constants`) flag:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
./bin/generate-rule "no-string-templates" -P
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
If the rule has a fixer, you can add the `-F` (or `--fixable`) flag followed by
|
|
92
|
+
`"code"` or `"whitespace"`:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
./bin/generate-rule "no-string-templates" -F "whitespace"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Running tests
|
|
99
|
+
|
|
100
|
+
This command will run all tests in this repo:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
yarn test
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
To run a specific test and for TDD, follow this video:
|
|
107
|
+
https://vimeo.com/723326900/785d6fe167
|
|
108
|
+
|
|
109
|
+
## Building and releasing.
|
|
110
|
+
|
|
111
|
+
This is how releases are managed in this repo.
|
|
112
|
+
|
|
113
|
+
- We will create a branch with the next release version as its name (`1.X.Y`)
|
|
114
|
+
from master branch.
|
|
115
|
+
- Version in
|
|
116
|
+
[README.md](https://github.com/bigbinary/eslint-plugin-neeto/blob/axios-autofixers/README.md#L11)
|
|
117
|
+
and
|
|
118
|
+
[package.json](https://github.com/bigbinary/eslint-plugin-neeto/blob/axios-autofixers/package.json#L3)
|
|
119
|
+
will be updated to the current branch name.
|
|
120
|
+
- From now on, we can install the plugin to neeto-applications using the version
|
|
121
|
+
`1.X.Y`.
|
|
122
|
+
- We will create a draft PR of this branch targeting master. This keeps the
|
|
123
|
+
branch in sync with master branch (bot-bigbinary will auto-merge the changes).
|
|
124
|
+
- When all features have been built, we will deploy it to all neeto-applications
|
|
125
|
+
locally using `yalc` package manager. We won't raise PR until the deployment
|
|
126
|
+
and verification is successfully done locally for all neeto-applications. The
|
|
127
|
+
usage of yalc is explained in this video:
|
|
128
|
+
https://vimeo.com/722958162/9e931b640c
|
|
129
|
+
- In case if we notice any problem during verification, like any missed edge
|
|
130
|
+
cases, we will fix the problem in this repo and re-run `yalc push` to install
|
|
131
|
+
the latest changes.
|
|
132
|
+
- Once everything is fine and the verification is complete, we will create a
|
|
133
|
+
[new github release](https://github.com/bigbinary/eslint-plugin-neeto/releases/new)
|
|
134
|
+
from `1.X.Y` branch with the exact same name for the tag (`1.X.Y`). The target
|
|
135
|
+
branch will be kept as `1.X.Y`. This will create a tag from the latest `1.X.Y`
|
|
136
|
+
branch and this ensures that the latest commit on that branch will remain
|
|
137
|
+
intact even if that branch gets deleted.
|
|
138
|
+
- Whenever a new release is created with a new version number, the github
|
|
139
|
+
actions will automatically publish the built package to npm.
|
|
140
|
+
- Now we will squash and merge the PR `1.X.Y` to master and delete its source
|
|
141
|
+
branch. This will delete all commits except the top one (since we have created
|
|
142
|
+
a tag with it).
|
|
143
|
+
- Immediately, we will open another branch with the next version (`1.X.Y`) and
|
|
144
|
+
the cycle will continue.
|
|
145
|
+
- Now we can run `yalc remove eslint-plugin-neeto` to remove yalc based package
|
|
146
|
+
and run `yarn add eslint-plugin-neeto@1.X.Y` to fetch the latest changes from
|
|
147
|
+
npm in all repos and raise PR. You might be able to slightly tweak this script
|
|
148
|
+
to get the job done:
|
|
149
|
+
https://gist.github.com/jagannathBhat/42a584748d97fe134f0abadb191ef29a
|