eslint-config-airbnb

eslint “parsing error: Unexpected token {” in JSX

假如想象 提交于 2019-12-21 03:53:32
问题 const title = 'My Minimal React Webpack Babel Setups'; const App = () => (<div><b>{title}</b><img src={img} /></div>) This code occurs an error "ESLint Parsing Error: Unexpected token {" my .eslintrc.js file is like that module.exports = { "extends": "airbnb" }; and I install the packages like that "eslint": "^5.9.0", "eslint-config-airbnb": "^17.1.0", "eslint-loader": "^2.1.1", "eslint-plugin-import": "^2.14.0", "eslint-plugin-jsx-a11y": "^6.1.2", "eslint-plugin-react": "^7.11.1", I thought

Is there a clean way to infinitely use async functions?

我怕爱的太早我们不能终老 提交于 2019-12-11 08:03:42
问题 According to ESLint some code like this is not 'clean code' for(;;) { await *async function* } My aim is to infinitely loop a certain function, executing it one by one, without eventually crashing my app because of call stack limits. I have thought about it for some time but couldn't come up with anything else that would do the same. What ESLint suggests also wouldn't work in my case; they suggest starting all of the functions in the loop and awaiting their resolve/reject callback outside of

How to remove ESlint error no-unresolved from importing 'react'

六月ゝ 毕业季﹏ 提交于 2019-12-04 21:18:52
问题 no-unresolved https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md After installing eslint-import-resolver-webpack My .eslintrc config { "extends": "airbnb", "rules": { "comma-dangle": ["error", "never"], "semi": ["error", "always"], "react/jsx-filename-extension": 0, "react/prop-types": 0, "react/no-find-dom-node": 0, "jsx-a11y/label-has-for": 0 }, "globals": { "document": true, "window": true }, "env": { "jest": true }, "settings": { "import/resolver":

How do I set PropTypes for Higher Order Functional Component?

只谈情不闲聊 提交于 2019-12-04 18:54:19
问题 I'm using airbnb configuration for eslint and it's giving me this warning: [eslint] 'isLoading' is missing in props validation (react/prop-types) Is there a way to set PropTypes for isLoading? const withLoading = Component => ({ isLoading, ...rest }) => (isLoading ? <LoadingSpinner /> : <Component {...rest} />); Here's an example of how I use it: const Button = ({ onClick, className, children }) => ( <button onClick={onClick} className={className} type="button"> {children} </button> ); Button

Prettier + Airbnb's ESLint config

别来无恙 提交于 2019-12-04 08:03:12
问题 Recently, I've started using Visual Studio Code for my editor and found the Prettier - JavaScript formatter. I think it's a great plugin because it helps me keep my code looking nice. I set up Airbnb's ESLint config and have found that to be super helpful. Here's the catch. The Airbnb ESLint config I'm currently running doesn't play nice with Prettier. For example, for JavaScript string, Prettier is formatted to include double ticks and Airbnb's ESLint like single ticks. When I format the

How do I set PropTypes for Higher Order Functional Component?

大城市里の小女人 提交于 2019-12-03 12:21:36
I'm using airbnb configuration for eslint and it's giving me this warning: [eslint] 'isLoading' is missing in props validation (react/prop-types) Is there a way to set PropTypes for isLoading? const withLoading = Component => ({ isLoading, ...rest }) => (isLoading ? <LoadingSpinner /> : <Component {...rest} />); Here's an example of how I use it: const Button = ({ onClick, className, children }) => ( <button onClick={onClick} className={className} type="button"> {children} </button> ); Button.propTypes = { onClick: PropTypes.func.isRequired, className: PropTypes.string, children: PropTypes

Prettier + Airbnb's ESLint config

你。 提交于 2019-12-02 20:21:00
Recently, I've started using Visual Studio Code for my editor and found the Prettier - JavaScript formatter. I think it's a great plugin because it helps me keep my code looking nice. I set up Airbnb's ESLint config and have found that to be super helpful. Here's the catch. The Airbnb ESLint config I'm currently running doesn't play nice with Prettier. For example, for JavaScript string, Prettier is formatted to include double ticks and Airbnb's ESLint like single ticks. When I format the code using Prettier, then Airbnb's ESLint doesn't agree. I know Kent Dodds has done some work with ESLint

JSX not allowed in files with extension ' .js' with eslint-config-airbnb

谁说胖子不能爱 提交于 2019-11-28 05:10:19
I've installed eslint-config-airbnb that is supposed to pre configure ESLINT for React: Our default export contains all of our ESLint rules, including ECMAScript 6+ and React. It requires eslint, eslint-plugin-import, eslint-plugin-react, and eslint-plugin-jsx-a11y. My .eslintrc extending its configuration: { "extends": "eslint-config-airbnb", "env": { "browser": true, "node": true, "mocha": true }, "rules": { "new-cap": [2, { "capIsNewExceptions": ["List", "Map", "Set"] }], "react/no-multi-comp": 0, "import/default": 0, "import/no-duplicates": 0, "import/named": 0, "import/namespace": 0,

JSX not allowed in files with extension ' .js' with eslint-config-airbnb

拥有回忆 提交于 2019-11-27 05:23:30
问题 I've installed eslint-config-airbnb that is supposed to pre configure ESLINT for React: Our default export contains all of our ESLint rules, including ECMAScript 6+ and React. It requires eslint, eslint-plugin-import, eslint-plugin-react, and eslint-plugin-jsx-a11y. My .eslintrc extending its configuration: { "extends": "eslint-config-airbnb", "env": { "browser": true, "node": true, "mocha": true }, "rules": { "new-cap": [2, { "capIsNewExceptions": ["List", "Map", "Set"] }], "react/no-multi