Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add linter for projects #8

Closed
osmannkartall opened this issue Aug 3, 2021 · 0 comments
Closed

add linter for projects #8

osmannkartall opened this issue Aug 3, 2021 · 0 comments
Assignees
Labels
feature New feature or request

Comments

@osmannkartall
Copy link
Owner

osmannkartall commented Aug 3, 2021

React:

  • We created react application with create-react-app tool which handles a lot of configurations for us. The tool comes with ESLint as well but it has limitations. We want to add airbnb plugin but when we do that eslint warnings start to cause errors and application fails to compile. To avoid this and just give warnings we found this work-around.
cd web

# install
npm i eslint-config-airbnb
// Add "extends": "airbnb" to your .eslintrc(in web/package.json)
"eslintConfig": {
    "extends": [
      // ...
      "airbnb"
    ]
},

// Set ESLint to just print out warnings in terminal rather than causing error(in web/package.json)
"scripts": {
    "start": "ESLINT_NO_DEV_ERRORS='true' react-scripts start",
    "build": "DISABLE_ESLINT_PLUGIN='true' react-scripts build",
    // ...
},

Node.js:

cd server

# Install ESLint as dev dependency.
npm i --save-dev eslint

# Create ESLint configuration(Follow the steps in referenced link but choose Airbnb style guide rather than Google style guide).
./node_modules/.bin/eslint --init

Reference

@osmannkartall osmannkartall added the feature New feature or request label Aug 3, 2021
@osmannkartall osmannkartall self-assigned this Aug 3, 2021
@osmannkartall osmannkartall reopened this Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Status: Done
Development

No branches or pull requests

1 participant