@bigbinary/eslint-plugin-neeto 1.0.19 → 1.0.20
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 +8 -120
- package/dist/index.js +4 -4
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ neeto.
|
|
|
8
8
|
Install the plugin from npm:
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
yarn add -D "@bigbinary/eslint-plugin-neeto@
|
|
11
|
+
yarn add -D "@bigbinary/eslint-plugin-neeto@latest"
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
In your eslintrc.js file, add `neeto` in the `plugins` list and add the
|
|
@@ -52,6 +52,7 @@ module.exports = {
|
|
|
52
52
|
- [consistent-button-link-anchor](./docs/src/rules/consistent-button-link-anchor.md)
|
|
53
53
|
- [ensure-zustand-stores-are-type-annotated](./docs/src/rules/ensure-zustand-stores-are-type-annotated.md)
|
|
54
54
|
- [ensure-zustand-import-names-are-consistent](./docs/src/rules/ensure-zustand-import-names-are-consistent.md)
|
|
55
|
+
- [files-inside-react-query-folder-should-end-with-api](./docs/src/rules/files-inside-react-query-folder-should-end-with-api.md)
|
|
55
56
|
- [file-name-and-export-name-standards](./docs/src/rules/file-name-and-export-name-standards.md)
|
|
56
57
|
- [minimize-zustand-store-access-scope](./docs/src/rules/minimize-zustand-store-access-scope.md)
|
|
57
58
|
- [neetocommons-tips](./docs/src/rules/neetocommons-tips.md)
|
|
@@ -75,129 +76,16 @@ module.exports = {
|
|
|
75
76
|
- [use-axios-config-for-passing-query-parameters](./docs/src/rules/use-axios-config-for-passing-query-parameters.md)
|
|
76
77
|
- [use-common-routes](./docs/src/rules/use-common-routes.md)
|
|
77
78
|
- [use-neetoui-classes](./docs/src/rules/use-neetoui-classes.md)
|
|
79
|
+
- [use-react-query-for-managing-remote-data](./docs/src/rules/use-react-query-for-managing-remote-data.md)
|
|
78
80
|
- [use-snake-case-for-api-connector-filename](./docs/src/rules/use-snake-case-for-api-connector-filename.md)
|
|
79
81
|
- [use-webpack-alias](./docs/src/rules/use-webpack-alias.md)
|
|
80
82
|
- [webpack-aliases-and-jsconfig-paths-should-be-in-sync](./docs/src/rules/webpack-aliases-and-jsconfig-paths-should-be-in-sync.md)
|
|
81
83
|
- [zustand-recommend-comparator-function-usage](./docs/src/rules/zustand-recommend-comparator-function-usage.md)
|
|
82
84
|
- [zustand-use-prop-to-pick-single-item](./docs/src/rules/zustand-use-prop-to-pick-single-item.md)
|
|
83
|
-
- [files-inside-react-query-folder-should-end-with-api](./docs/src/rules/files-inside-react-query-folder-should-end-with-api.md)
|
|
84
|
-
- [use-react-query-for-managing-remote-data](./docs/src/rules/use-react-query-for-managing-remote-data.md)
|
|
85
|
-
|
|
86
|
-
## Development setup
|
|
87
|
-
|
|
88
|
-
### Initialization
|
|
89
|
-
|
|
90
|
-
Clone this repo and initialize it by running `yarn install`
|
|
91
|
-
|
|
92
|
-
### Creating new rules
|
|
93
|
-
|
|
94
|
-
You can use the script [`bin/generate-rule`](./bin/generate-rule) to scaffold a
|
|
95
|
-
new rule.
|
|
96
|
-
|
|
97
|
-
#### Usage:
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
./bin/generate-rule <rule-name> [--description=<rule-description-inside-quotes>] [--type=<rule-type>] [-P]
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
#### Examples:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
./bin/generate-rule "no-string-templates" --description="Disallows the use of string templates in JS" --type="suggestion"
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
`-D` is an alias for `--description`<br/> `-T` is an alias for `--type` You can
|
|
110
|
-
rewrite the same command as:
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
./bin/generate-rule "no-string-templates" -D "Disallows the use of string templates in JS" -T "suggestion"
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
If you don't need to generate a `constants.js` file for the rule, you can add
|
|
117
|
-
the `-C` (or `--without-constants`) flag:
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
./bin/generate-rule "no-string-templates" -P
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
If the rule has a fixer, you can add the `-F` (or `--fixable`) flag followed by
|
|
124
|
-
`"code"` or `"whitespace"`:
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
./bin/generate-rule "no-string-templates" -F "whitespace"
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Running tests
|
|
131
|
-
|
|
132
|
-
This command will run all tests in this repo:
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
yarn test
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
To run a specific test and for TDD, follow this video:
|
|
139
|
-
https://vimeo.com/723326900/785d6fe167
|
|
140
|
-
|
|
141
|
-
## Building and releasing
|
|
142
|
-
|
|
143
|
-
Follow these steps to create a new release:
|
|
144
|
-
|
|
145
|
-
- Before starting work on the new release, create a branch with the next release
|
|
146
|
-
version as its name (`1.X.Y`) from main branch.
|
|
147
|
-
|
|
148
|
-
- Update the version of the package in [README.md](README.md) and
|
|
149
|
-
[package.json](package.json), and commit the changes in the branch that was
|
|
150
|
-
created in the previous step.
|
|
151
|
-
|
|
152
|
-
- Create a draft PR of this branch targeting `main` and start working on the new
|
|
153
|
-
release.
|
|
154
|
-
|
|
155
|
-
Whenever a PR is merged to `main`, `bot-bigbinary` will auto-merge those
|
|
156
|
-
changes to this PR as well. This way the branch will stay in sync with `main`.
|
|
157
|
-
|
|
158
|
-
- Add a checklist to the PR `1.X.Y` whenever a new change is auto-added to it
|
|
159
|
-
(when another feature PR is merged). The checklist will be helpful during
|
|
160
|
-
deployment and while writing migration guides.
|
|
161
|
-
|
|
162
|
-
- Test the new release using in all the repos using `yalc`. The usage of `yalc`
|
|
163
|
-
is explained in [this video](https://vimeo.com/722958162/9e931b640c).
|
|
164
|
-
|
|
165
|
-
- In case there is any problem during the test, like any missed edge cases, fix
|
|
166
|
-
the problem and run the following to install the latest changes:
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
yalc push
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
- Once all the PRs are created and all issues are rectified, mark the draft PR
|
|
173
|
-
we created for the release as ready and get it merged.
|
|
174
|
-
|
|
175
|
-
- Create a
|
|
176
|
-
[new github release](https://github.com/bigbinary/eslint-plugin-neeto/releases/new)
|
|
177
|
-
with the following details:
|
|
178
|
-
|
|
179
|
-
Tag name: `1.X.Y` (use `Create new tag on publish` option)
|
|
180
|
-
|
|
181
|
-
Target: `main`
|
|
182
|
-
|
|
183
|
-
Release Title: `v1.X.Y`
|
|
184
|
-
|
|
185
|
-
Click on `Generate release notes` for filling in the description.
|
|
186
|
-
|
|
187
|
-
- Whenever a new release is created with a new version number, the github
|
|
188
|
-
actions will automatically publish the built package to npm.
|
|
189
|
-
|
|
190
|
-
- Immediately open another branch with the next version (`1.X.Y`) so that the
|
|
191
|
-
cycle can continue.
|
|
192
|
-
|
|
193
|
-
- Now run the following commands to replace the `yalc` based package with our
|
|
194
|
-
new release from npm:
|
|
195
85
|
|
|
196
|
-
|
|
197
|
-
yalc remove @bigbinary/eslint-plugin-neeto
|
|
198
|
-
yarn add -D @bigbinary/eslint-plugin-neeto@1.X.Y
|
|
199
|
-
```
|
|
86
|
+
## Other references
|
|
200
87
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
88
|
+
- [Development instructions](./docs/general/development-instructions.md)
|
|
89
|
+
- [Creating new rules](./docs/general/creating-new-rules.md)
|
|
90
|
+
- [Running test](./docs/general/running-tests.md)
|
|
91
|
+
- [Building and releasing](./docs/general/building-and-releasing.md)
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
const loadJS = jsPath => {
|
|
15
15
|
try {
|
|
16
16
|
return require(path$2.resolve(__dirname, "../../../..", jsPath));
|
|
17
|
-
} catch
|
|
17
|
+
} catch {
|
|
18
18
|
return {};
|
|
19
19
|
}
|
|
20
20
|
};
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@bigbinary/neeto/no-missing-localization": ["error", {
|
|
79
79
|
name: "en.json",
|
|
80
80
|
lng: "en",
|
|
81
|
-
content:
|
|
81
|
+
content: loadJS("app/javascript/src/translations/en.json")
|
|
82
82
|
}],
|
|
83
83
|
"@bigbinary/neeto/no-namespace-specifier-import-for-ramda": "error",
|
|
84
84
|
"@bigbinary/neeto/no-redundant-jsx-expression": "error",
|
|
@@ -357,7 +357,7 @@
|
|
|
357
357
|
* also @see matches
|
|
358
358
|
*/
|
|
359
359
|
|
|
360
|
-
const matchesAny = ramda.curry((list, obj) => list.some(matches(ramda.__, obj)));
|
|
360
|
+
const matchesAny = /*#__PURE__*/ramda.curry((list, obj) => list.some(matches(ramda.__, obj)));
|
|
361
361
|
/**
|
|
362
362
|
* Checks if the given pattern exists somewhere deep inside
|
|
363
363
|
* the given object-tree by partial object matching.
|
|
@@ -366,7 +366,7 @@
|
|
|
366
366
|
* @param {Object} obj the object tree to check
|
|
367
367
|
*/
|
|
368
368
|
|
|
369
|
-
const patternExistsDeep = ramda.curry((pattern, obj) => {
|
|
369
|
+
const patternExistsDeep = /*#__PURE__*/ramda.curry((pattern, obj) => {
|
|
370
370
|
if (typeof obj !== "object" || ramda.isNil(obj)) return false;
|
|
371
371
|
if (matches(pattern, obj)) return true;
|
|
372
372
|
return Object.entries(obj).some(([key, value]) => {
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/eslint-plugin-neeto",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepare": "husky install",
|
|
8
8
|
"test": "npm run build && jest dist/util-tests.spec.js && node dist/rule-tests.js",
|
|
9
|
-
"build": "rollup -c rollup.config.js"
|
|
9
|
+
"build": "rollup -c rollup.config.js",
|
|
10
|
+
"watch": "rollup -c rollup.config.js --watch"
|
|
10
11
|
},
|
|
11
12
|
"lint-staged": {
|
|
12
13
|
"{package.json}": [
|