Comments (16)
@vhmth updating each rule with comments above
from webext-redux.
spaces over tabs
.... Looks like we can continue working together :D
from webext-redux.
Thanks, @vhmth ! We use ESLint as well at GoGuardian.
Looking forward to seeing your proposal.
from webext-redux.
{
"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.
Hmm I'm digging this @paulius005 - very similar to what we use at Loom.
from webext-redux.
@tshaddix @vhmth updated each prop with an explanation
comment above respective prop
from webext-redux.
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.
@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.
@paulius005 Come on... I'm not an animal
from webext-redux.
🤣
from webext-redux.
{
"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.
here is the final-ish version then :)
from webext-redux.
Awesome @paulius005 you wanna open a PR for this whenever you get the chance then? That's probably the next step.
from webext-redux.
from webext-redux.
We can close this now, yeah? :)
from webext-redux.
Yessir!
from webext-redux.
Related Issues (20)
- When opening extension in multiple browser windows store gets reset
- Hot reloading using yarn start leads to error - chrome.runtime.connect() called from a webpage must specify an Extension ID
- Ensure chrome api available before checking lastError
- Mozilla WebExtension-Polyfill support? HOT 3
- What is way to creating Chrome extention with default create-react-app?
- Cannot read properties of undefined (reading 'error') HOT 1
- Storyful is using webext-redux
- wrapStore tabs.query has extra argument
- "can't access dead object" while developing on Firefox
- saga middleware typescript problem
- Question: Advise for hot reloading in development HOT 1
- Doesn't work with react-redux v8 HOT 3
- Is manifest version 3 support planned? HOT 3
- How to fix Uncaught TypeError: Cannot read properties of undefined (reading 'state') HOT 7
- Data not persisting HOT 2
- React Redux State updated value not showing on page refresh
- Is this repo still actively maintained & supported?
- middleware warning when using rtk-query
- useselector not working despite providing store
- How to re-sync store from "content script" with background.js (service worker)? HOT 2
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 webext-redux.