eslint-plugin-neeto v1.0.10
eslint-plugin-neeto
An ESLint plugin for enforcing common front-end best practices specifically for neeto.
Usage
Install the plugin from npm:
yarn add -D "eslint-plugin-neeto@1.0.10"
In your eslintrc.js file, add neeto
in the plugins
list and add the required
rules.
module.exports = {
// ...other configurations
plugins: [
// ...other plugins
"neeto",
],
rules: {
"neeto/ramda-tips": "warn",
// ...other rules
},
};
Exported rules
- api-connector-name-should-match-filename
- api-connector-should-use-default-export
- combine-multiple-independent-awaits
- no-axios-import-outside-apis
- no-dangling-constants
- no-dangling-functions
- no-excess-function-arguments
- no-globalProps-destructure
- no-globalProps-reassignment
- no-missing-localization
- no-namespace-specifier-import-for-ramda
- no-redundant-jsx-expression
- no-redundant-string-templates
- prefix-neeto-ui-import-alias
- ramda-tips
- use-axios-config-for-passing-query-parameters
- use-constant-case
- use-snake-case-for-api-connector-filename
- use-webpack-alias
Development setup
Initialization
Clone this repo and initialize it by running yarn install
Creating new rules
You can use the script bin/generate-rule
to scaffold a
new rule.
Usage:
./bin/generate-rule <rule-name> [--description=<rule-description-inside-quotes>] [--type=<rule-type>] [-P]
Examples:
./bin/generate-rule "no-string-templates" --description="Disallows the use of string templates in JS" --type="suggestion"
-D
is an alias for --description
-T
is an alias for --type
You can
rewrite the same command as:
./bin/generate-rule "no-string-templates" -D "Disallows the use of string templates in JS" -T "suggestion"
If you don't need to generate a constants.js
file for the rule, you can add
the -C
(or --without-constants
) flag:
./bin/generate-rule "no-string-templates" -P
If the rule has a fixer, you can add the -F
(or --fixable
) flag followed by
"code"
or "whitespace"
:
./bin/generate-rule "no-string-templates" -F "whitespace"
Running tests
This command will run all tests in this repo:
yarn test
To run a specific test and for TDD, follow this video: https://vimeo.com/723326900/785d6fe167
Building and releasing.
This is how releases are managed in this repo.
- We will create a branch with the next release version as its name (
1.X.Y
) from master branch. - Version in README.md and package.json will be updated to the current branch name.
- From now on, we can install the plugin to neeto-applications using the version
1.X.Y
. - We will create a draft PR of this branch targeting master. This keeps the branch in sync with master branch (bot-bigbinary will auto-merge the changes).
- When all features have been built, we will deploy it to all neeto-applications
locally using
yalc
package manager. We won't raise PR until the deployment and verification is successfully done locally for all neeto-applications. The usage of yalc is explained in this video: https://vimeo.com/722958162/9e931b640c - In case if we notice any problem during verification, like any missed edge
cases, we will fix the problem in this repo and re-run
yalc push
to install the latest changes. - Once everything is fine and the verification is complete, we will create a
new github release
from
1.X.Y
branch with the exact same name for the tag (1.X.Y
). The target branch will be kept as1.X.Y
. This will create a tag from the latest1.X.Y
branch and this ensures that the latest commit on that branch will remain intact even if that branch gets deleted. - Whenever a new release is created with a new version number, the github actions will automatically publish the built package to npm.
- Now we will squash and merge the PR
1.X.Y
to master and delete its source branch. This will delete all commits except the top one (since we have created a tag with it). - Immediately, we will open another branch with the next version (
1.X.Y
) and the cycle will continue. - Now we can run
yalc remove eslint-plugin-neeto
to remove yalc based package and runyarn add eslint-plugin-neeto@1.X.Y
to fetch the latest changes from npm in all repos and raise PR. You might be able to slightly tweak this script to get the job done: https://gist.github.com/jagannathBhat/42a584748d97fe134f0abadb191ef29a