If you are not familiar with linters and Stickler, read root level README.
Please do the following steps in this order:
- Install stickler-ci https://github.com/apps/stickler-ci
- Enable stickler in your repo. You can do it here.
- In first commit of your feature branch add a copy of .stickler.yml and .eslintrc.json to the root directory.
- Remember to use both files linked above
- Remember that
.stickler.yml
file name starts with a dot.
- Do not make any changes in config files - they represent style guidelines that you share with your tem - which is a group of all Microverse students.
- If you think that change is necessary - open a Pull Request in this repository and let your code reviewer know about it.
- When you open your first pull request you should see Stickler's report at
Checks
tab.
-
Run
npm install eslint eslint-config-airbnb --save-dev
(not sure how to use npm? Read this). -
Run
npx eslint --init
. -
Make sure you select the following options when prompted.
? How would you like to use ESLint?
To check syntax, find problems, and enforce code style? What type of modules does your project use?
JavaScript modules (import/export)? Which framework does your project use?
React? Does your project use Typescript
No? Where does your code run?
Browser? How would you like to define a style for your project?
Use a popular style guide? Which style guide do you want to follow?
Airbnb? What format do you want your config file to be in?
JSONThe config that you've selected requires the following dependencies: ? Would you like to install them now with npm?
Yes -
Copy the contents of .eslintrc.json to the newly generated
.eslintrc.json
overwritting the previous content. -
Do not make any changes in config files - they represent style guidelines that you share with your tem - which is a group of all Microverse students.
- If you think that change is necessary - open a Pull Request in this repository and let your code reviewer know about it.
-
Double check your
./src
folder for any extra unnecesary.eslint
config files that might have been generated as this might cause an issue with stickler when you create your Pull Request later on. -
Run
npx eslint .
. -
Fix linter errors.
-
IMPORTANT NOTE: feel free to research auto-correct options for ESlint if you get a flood of errors but keep in mind that correcting style errors manually will help you to make a habit of writing a clean code!
-
All config files are in my repo but Stickler does not work.
- Make sure that Stickler app has permission to access your repository. Find Stickler here https://github.com/settings/installations and check its configuration.
- Try to add a new commit to your Pull Request. Stickler should detect changes in your repo and start checking your code.
-
while scanning for the next token found character '\t' that cannot start any token
error.- Please make sure that you used spaces not tabs for indentation.
-
Check if someone else has had similar problem before here. Please make sure that you used spaces not tabs for indentation.
-
Stickler does not work and nothing helps 💥 - run eslint in your local env and correct all errors. Remember to let your Code Reviewer know that you had problems with Stickler and you used linter in local env.