Share
Strict ESLint config for React, ES6 (based on Airbnb Code style) - .eslintrc.js. Embed Sign in Sign up Instantly share code, notes, and snippets. Stack Overflow for Teams is a private, secure spot for you and Source: Airbnb style guide. I use ESLint with the Airbnb style, but I have these errors:As you can see above, I would like to indent with tab.I also tried to indent why 2 spaces, without success. Instantly share code, notes, and snippets. I really don't understand why I have theses errors. Active 3 years, 8 months ago. Learn more about clone URLs Examples.
The Overflow Blog You could do this: //index.js const app = React.createElement(App); ReactDOM.render(app, document.getElementById('root')); 0. Unforgettable trips start with Airbnb.
Embed this gist in your website. I'm working on a React.js application and I'm trying to lint my code. Really lightweight and good browser support! Free 30 Day Trial
nkbt /.eslintrc.js. 0: required by `babel-eslint`// These rules have to do with variable declarations.// disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment)// disallow labels that share a name with a variable// disallow declaration of variables already declared in the outer scope// disallow use of undeclared variables unless mentioned in a /*global */ block// disallow use of undefined when initializing variables// disallow use of undefined variable (off by default)// disallow declaration of variables that are not used in the code// disallow use of variables before they are defined// These rules are purely matters of style and are quite subjective.// this option sets a specific tab width for your code (off by default)// enforces consistent naming when capturing the current execution context (off by default)// enforce newline at the end of file, with no multiple empty lines// require function expressions to have a name (off by default)// enforces use of function declarations or expressions (off by default)// enforces spacing between keys and values in object literal properties// specify the maximum depth callbacks can be nested (off by default)// disallow the omission of parentheses when invoking a constructor with no arguments// allow/disallow an empty newline after var statement (off by default)// disallow comments inline after code (off by default)// disallow if as the only statement in an else block (off by default)// disallow nested ternary expressions (off by default)// disallow space between function identifier and application// disallow the use of ternary operators (off by default)// disallow trailing whitespace at the end of lines// disallow wrapping of non-IIFE statements in parens// allow just one var statement per function (off by default)// require assignment operator shorthand where possible or prohibit it entirely (off by default)// require quotes around object literal property names (off by default)// specify whether double or single quotes should be used// require or disallow use of semicolons instead of ASI// sort variables within the same declaration block (off by default)// require a space after certain keywords (off by default)// require or disallow space before blocks (off by default)// require or disallow space before function opening parenthesis (off by default)// require or disallow spaces inside brackets (off by default)// require or disallow spaces inside parentheses (off by default)// Require or disallow spaces before/after unary operators (words on by default, nonwords off by default)// require or disallow a space immediately following the // in a line comment (off by default)// require regex literals to be wrapped in parentheses (off by default)// These rules are only relevant to ES6 environments and are off by default.// require let or const instead of var (off by default)// enforce the spacing around the * in generator functions (off by default)// The following rules are included for compatibility with JSHint and JSLint.// While the names of the rules may not match up with the JSHint/JSLint counterpart,// specify the maximum depth that blocks can be nested (off by default)// specify the maximum length of a line in your program (off by default)// limits the number of parameters that can be used in the function declaration.
Last active Aug 8, 2020. No more for loops are required to copy the items of an array. Good editors (sublime is one!) // The following rules point out areas where you might have made mistakes.// disallow use of console (off by default in the node environment)// disallow use of constant expressions in conditions// disallow control characters in regular expressions// disallow duplicate keys when creating object literals// disallow the use of empty character classes in regular expressions// disallow assigning to the exception in a catch block// disallow double-negation boolean casts in a boolean context// disallow unnecessary parentheses (off by default)// disallow overwriting functions written as function declarations// disallow function or variable declarations in nested blocks// disallow invalid regular expression strings in the RegExp constructor// disallow irregular whitespace outside of strings and comments// disallow negation of the left operand of an in expression// disallow the use of object properties of the global object (Math and JSON) as functions// disallow multiple spaces in a regular expression literal// disallow reserved words being used as object literal keys (off by default)// disallow unreachable statements after a return, throw, continue, or break statement// Ensure JSDoc comments are valid (off by default)// Ensure that the results of typeof are compared against a valid string// These are rules designed to prevent you from making mistakes.// They either prescribe a better way of doing something or help you avoid footguns.// treat var statements as if they were block scoped (off by default). Hi,At work, we use the AirBnB JS style guide conventions/ formatting and I'm wondering if anyone out there has created an Code Style Schema file that they wouldn't mind sharing that matches :)Thanks! Just install eslint-config-airbnb-standard npm module globally: npm install --global eslint-config-airbnb …