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

configure eslint in create react app #2318

Closed
ashishsingh2641 opened this issue May 22, 2017 · 2 comments
Closed

configure eslint in create react app #2318

ashishsingh2641 opened this issue May 22, 2017 · 2 comments

Comments

@ashishsingh2641
Copy link

ashishsingh2641 commented May 22, 2017

// Package Json
{
"name": "react-app",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-core": "^6.21.0",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.2.10",
"babel-preset-es2015": "^6.18.0",
"bootstrap": "^4.0.0-alpha.6",
"css-loader": "^0.26.1",
"eslint": "^3.15.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-config-react-app": "^0.6.2",
"eslint-loader": "^1.7.1",
"eslint-plugin-flowtype": "^2.21.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.9.0",
"jest": "^19.0.2",
"node-sass": "^4.5.0",
"node-sass-chokidar": "0.0.1",
"npm-install-webpack-plugin": "^4.0.4",
"npm-run-all": "^v4.0.1",
"pushstate-server": "^3.0.0",
"react-cookie": "^1.0.5",
"react-intl": "^2.2.3",
"react-router-dom": "^4.1.1",
"react-scripts": "0.8.4"
},
"dependencies": {
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.2.10",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-es2015-modules-commonjs-simple": "^6.7.4",
"babel-plugin-transform-object-rest-spread": "^6.22.0",
"babel-plugin-transform-runtime": "^6.7.5",
"babel-polyfill": "^6.22.0",
"babel-preset-es2015": "^6.22.0",
"babel-preset-es2015-native-modules": "^6.6.0",
"babel-preset-react": "^6.22.0",
"config": "^1.24.0",
"jquery": "^3.1.1",
"prop-types": "^15.5.8",
"react": "^15.5.4",
"react-addons-css-transition-group": "^15.4.2",
"react-addons-transition-group": "^15.4.2",
"react-dom": "^15.4.1",
"react-intl": "^2.2.3",
"react-router": "^4.1.1",
"reactstrap": "^4.2.0"
},
"scripts": {
"build-css": "node-sass-chokidar src/ -o src/",
"watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive",
"start-js": "react-scripts start",
"start": "npm-run-all -p watch-css start-js",
"build": "npm run build-css && react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "npm-run-all -p watch-css start-js",
"eslint": "eslint ."
},
"eslintConfig": {
"env": {
"browser": true,
"node": true
}
},
"description": "ReactComponent Development Documentation.",
"main": "index.js",
"author": "",
"license": "ISC"
}

// .eslint file
{
"extends": ["react-app", "plugin:jsx-a11y/recommended"],
"plugins": ["jsx-a11y"],
"env": {
"browser": true,
"commonjs": false,
"node": true,
"es6": true
},
"parserOptions": {
"ecmaVersion": 6
},
"rules": {
"object-curly-spacing": [2, "never"],
"arrow-body-style": 0,
"indent": [0, 4],
"react/jsx-indent": "on",
"react/jsx-filename-extension": "on",
"comma-dangle": 0,
"no-trailing-spaces": 0,
"space-before-function-paren": 0,
"func-names": 0,
"new-cap": 0,
"max-len": [2, 120],
"react/prefer-stateless-function": 0,
"react/jsx-indent-props": [2, 4],
"react/prop-types": 0,
"react/no-multi-comp": 0,
"react/jsx-closing-bracket-location": 0,
"no-param-reassign": [2, {"props": false}],
"no-tabs": "off",
"arrow-parens": "off",
"import/newline-after-import": "on",
"import/extensions":"off",
"no-undef":"off",
"linebreak-style":"off",
"warning": false
}
}

npm warning

Can anyone suggest me how to restrict warning(error) as error in the eslint configuration

@gaearon
Copy link
Contributor

gaearon commented May 22, 2017

I’m not sure what you’re asking, sorry.
You can refer to ESLint documentation for configuring rules.

We are happy to help with unejected setup, but since you ejected, we recommend checking the underlying projects for help and documentation since everybody’s ejected setup is different.

@dotku
Copy link

dotku commented Jan 1, 2019

How can we add max-len to the lint by the way?

@lock lock bot locked and limited conversation to collaborators Jan 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants