Giter VIP home page Giter VIP logo

Comments (16)

paulius005 avatar paulius005 commented on June 1, 2024 3

@vhmth updating each rule with comments above

from webext-redux.

paulius005 avatar paulius005 commented on June 1, 2024 1

spaces over tabs.... Looks like we can continue working together :D

from webext-redux.

tshaddix avatar tshaddix commented on June 1, 2024

Thanks, @vhmth ! We use ESLint as well at GoGuardian.

Looking forward to seeing your proposal.

from webext-redux.

paulius005 avatar paulius005 commented on June 1, 2024
{
  "extends": ["eslint:recommended", "plugin:react/recommended"],
  "env": {
    "es6": true,
    "browser": true,
    "commonjs": true,
    "jquery": true
  },
  "globals": {
    "React": true,
    "chrome": true
  },
  "parser": "babel-eslint",
  "rules": {
    // spaces before and after error
    "arrow-spacing": "error",
    // spaces before and after curly braces on the same line
    "block-spacing": "error",
    // require curly braces for if, while, for
    "curly": "error",
    // require default case for switch statements
    "default-case": "error",
    // 2 space indentation with exceptions for variable declarators so you can line up multiple
    // in this way:
    // const x,
    //       y; 
    "indent": [2, 2, {"SwitchCase": 1, "VariableDeclarator": {"var": 2, "let": 2, "const": 3}}],
    // new line after variable declarations 
    "newline-after-var": ["error", "always"],
    // no debuggers
    "no-debugger": "error",
    //  if we're returning in an if, no need to return with an else, just return statement after if
    "no-else-return": "error",
    // no .bind() on arrow funcs and on IIFEs
    "no-extra-bind": "error",
    // no !! or converting numbers into strings
    "no-implicit-coercion": "error",
    // no multiple spaces used for spacing unless we're lining up variable declerations
    "no-multi-spaces": ["error", { "exceptions": { "VariableDeclarator": true, "AssignmentExpression": true } }],
    // limit es6 string interpolation to use `` only, no "" or ''
    "no-template-curly-in-string": "error",
    // no trailing spaces
    "no-trailing-spaces": "warn",
    // can't assign variable to undefined 
    "no-undef-init": "error",
    // must use all vars
    "no-unused-vars": "error",
    // let or const only
    "no-var": 1,
    // if key and value are the same, just use one word
    "object-shorthand": "error",
    // prefer arrow where possible
    "prefer-arrow-callback": "error",
    // const when variable is not reasigned 
    "prefer-const": "error",
    // Reflect.deleteProperty over delete something
    "prefer-reflect": "error",
    // dont require component name, maybe we should?
    "react/display-name": "off",
    // improve the reusability of components by requiring prop tptes
    "react/prop-types": "error",
    // if function async, make sure there's an await... super useful
    "require-await": "error",
    // require semicolon where appropriate http://eslint.org/docs/rules/semi
    "semi": "error",
    // space before function parens function[SPACE_HERE]() with explicit cases
    "space-before-function-paren": ["error", {
      "anonymous": "always",
      "named": "never",
      "asyncArrow": "ignore"
    }],
    // one space after comment slashes
    "spaced-comment": 1,
    // enforce use-strict 
    "strict": "error"
  }
}

@tshaddix here is my initial proposal we can go through a dissect each one :)

from webext-redux.

vhmth avatar vhmth commented on June 1, 2024

Hmm I'm digging this @paulius005 - very similar to what we use at Loom.

from webext-redux.

paulius005 avatar paulius005 commented on June 1, 2024

@tshaddix @vhmth updated each prop with an explanation

comment above respective prop

from webext-redux.

vhmth avatar vhmth commented on June 1, 2024

Love all of them. The one thing I'm not sure on is react/* rules. Do we need those in this repo? I don't think we have any React components in here that I know of.

from webext-redux.

tshaddix avatar tshaddix commented on June 1, 2024

@paulius005 Awesome! Thanks for putting this together!

As @vhmth mentioned, I think we can X the react and jquery sections of this considering this package does not use either of those.

Other than that, I'm not too opinionated and appeciate consistency above everything. As long as we chose spaces over tabs and enforce semi-colons, that is :P

from webext-redux.

tshaddix avatar tshaddix commented on June 1, 2024

@paulius005 Come on... I'm not an animal

from webext-redux.

vhmth avatar vhmth commented on June 1, 2024

🤣

from webext-redux.

paulius005 avatar paulius005 commented on June 1, 2024
{
  "extends": ["eslint:recommended"],
  "env": {
    "es6": true,
    "browser": true,
    "commonjs": true,
    "jquery": true
  },
  "globals": {
    "chrome": true
  },
  "parser": "babel-eslint",
  "rules": {
    "arrow-spacing": "error",
    "block-spacing": "error",
    "curly": "error",
    "default-case": "error",
    "indent": [2, 2, {"SwitchCase": 1, "VariableDeclarator": {"var": 2, "let": 2, "const": 3}}],
    "newline-after-var": ["error", "always"],
    "no-debugger": "error",
    "no-else-return": "error",
    "no-extra-bind": "error",
    "no-implicit-coercion": "error",
    "no-multi-spaces": ["error", { "exceptions": { "VariableDeclarator": true, "AssignmentExpression": true } }],
    "no-template-curly-in-string": "error",
    "no-trailing-spaces": "warn",
    "no-undef-init": "error",
    "no-unused-vars": "error",
    "no-var": 1,
    "object-shorthand": "error",
    "prefer-arrow-callback": "error",
    "prefer-const": "error",
    "prefer-reflect": "error",
    "require-await": "error",
    "semi": "error",
    "space-before-function-paren": ["error", {
      "anonymous": "always",
      "named": "never",
      "asyncArrow": "ignore"
    }],
    "spaced-comment": 1,
    "strict": "error"
  }
}

from webext-redux.

paulius005 avatar paulius005 commented on June 1, 2024

here is the final-ish version then :)

from webext-redux.

vhmth avatar vhmth commented on June 1, 2024

Awesome @paulius005 you wanna open a PR for this whenever you get the chance then? That's probably the next step.

from webext-redux.

paulius005 avatar paulius005 commented on June 1, 2024

#73

from webext-redux.

paulius005 avatar paulius005 commented on June 1, 2024

We can close this now, yeah? :)

from webext-redux.

vhmth avatar vhmth commented on June 1, 2024

Yessir!

from webext-redux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.