Comments (2)
You are using the experimental public class fields syntax, which is a proposal in stage 3, not yet in the language.
As you notice, you are able to use it because you are using Babel which will transform it for you. That's why ESLint complains, I don't think it is an Airbnb styleguide issue, is just that it is not in the language yet, and you have to use the babel-eslint
parser to avoid the issue with ESLint.
The way to do it using ES6 classes is documented on the React docs.
You have to bind your class methods on the constructor, something like this:
export class Searchform extends Component {
+ constructor(props) {
+ super(props);
+ this.onChange = this.onChange.bind(this);
+ this.onSubmit = this.onSubmit.bind(this);
+ }
- onChange = event => {
+ onChange(event) {
// ...
}
- onChange = event => {
+ onSubmit(event) {
// ...
}
You can check here the difference between the experimental feature and the ES6 classes.
from linters-config.
That solved the issue, however other linting errors raised instead, being "destructuring assignment" the most annoying.
It would be great if you guys remove the Airbnb style from the official linting files. Personally, I work with "eslint-recommended" along with prettier and resulting code is beautifully.
Don't take wrong, but for me projects from Microverse are really frustrating most of the time because of the linting style implemented which causes hours of time used in fixing linting errors instead of learning something more productive.
Thank you for your suppor @MauricioRobayo!
from linters-config.
Related Issues (20)
- Eslint complains about single named exports
- Please add /dist in line 20 of linters.yml
- Constant : Obsolete linters configuration file
- Ubuntu 18.04 depreciation HOT 1
- Linters config update HOT 1
- Warning: obsolete parameter `IgnoredMethods` in .robocop.yml file
- @-rule issues with plain SASS
- Setup Ruby action deprecation
- Please Update stylelintrc.json to include Tailwind CSS compiled file in 'ignoreFiles' key.
- Should hint linters throw an error on this line?
- Disabling Javascript "Line Break Style" Rule
- Ruby Lintes install
- Warning in rubocop.yml HOT 1
- linters.yml file throws "Lighthouse" error HOT 1
- Remove Template Literal HOT 2
- Linter/Eslint Configuration for React-Redux
- .rubocop.yml HOT 2
- Webhint Error [ERR_REQUIRE_ESM] HOT 4
- HTML & CSS3 Course - please edit
- Issue on npx hint .
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linters-config.