Skip to content

vlad-khitev-axon/axon-eslint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Axon eslint configs

Linting and formatting

First, configure eslint and prettier following instructions in the appropriate package:

Formatting Code on commit

After configuring eslint you can enable automatic code formatting before committing to git.

To format our code whenever we make a commit in git, we need to install the following dependencies:

npm install --save-dev husky lint-staged

Alternatively you may use yarn:

yarn add -D husky lint-staged

Now we can make sure every file is formatted correctly by adding a few lines to the package.json in the project root.

Add the following line to scripts section:

  "scripts": {
+   "precommit": "lint-staged",
    "start": "react-scripts start",
    "build": "react-scripts build",

Next we add a 'lint-staged' field to the package.json, for example:

  "dependencies": {
    // ...
  },
+ "lint-staged": {
+   "src/**/*.{js,jsx,json,css}": [
+     "prettier --single-quote --trailing-comma=all --write",
+     "git add"
+   ]
+ },
  "scripts": {

Now, whenever you make a commit, Prettier will format the changed files automatically. You can also run ./node_modules/.bin/prettier --single-quote --trailing-comma=all --write "src/**/*.{js,jsx,json,css}" to format your entire project for the first time.

About

Axon's JS ESLint configs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published