Skip to content

Instantly share code, notes, and snippets.

@akshendra
Last active January 18, 2019 20:38
Show Gist options
  • Save akshendra/2f4452883bb2a1c89054f2ec32371a30 to your computer and use it in GitHub Desktop.
Save akshendra/2f4452883bb2a1c89054f2ec32371a30 to your computer and use it in GitHub Desktop.
Common eslint config
{
"extends": [
"plugin:import/errors",
"plugin:import/warnings"
],
"settings": {
"import/resolver": {
"node": {
"extensions": [".mjs", ".js", ".json"]
}
},
"import/extensions": [
".js",
".mjs",
".jsx",
],
"import/core-modules": [
],
"import/ignore": [
"node_modules",
"\\.(coffee|scss|css|less|hbs|svg|json)$",
],
},
"env": {
"es6": true,
"node": true,
"mocha": true
},
"parserOptions": {
"ecmaVersion": 8
},
"rules": {
"import/no-unresolved": ["error", { "commonjs": true, "caseSensitive": true }],
"import/named": "error",
"import/default": "off",
"import/namespace": "off",
"import/export": "error",
"import/no-named-as-default": "error",
"import/no-named-as-default-member": "error",
"import/no-deprecated": "off",
"import/no-extraneous-dependencies": ["error", {
"devDependencies": [
"test/**",
"tests/**",
"spec/**",
"Gruntfile-beta.js",
"**/__tests__/**",
"test.{js,jsx}",
"test-*.{js,jsx}",
"**/*.{test,spec}.{js,jsx}",
"**/jest.config.js",
"**/webpack.config.js",
"**/webpack.config.*.js",
"**/rollup.config.js",
"**/rollup.config.*.js",
"**/gulpfile.js",
"**/gulpfile.*.js",
"**/Gruntfile{,.js}",
"**/protractor.conf.js",
"**/protractor.conf.*.js",
],
"optionalDependencies": false,
}],
"import/no-mutable-exports": "error",
"import/no-commonjs": "off",
"import/no-amd": "error",
"import/no-nodejs-modules": "off",
"import/first": ["error", "absolute-first"],
"import/imports-first": "off",
"import/no-duplicates": "error",
"import/no-namespace": "off",
"import/extensions": ["error", "always", {
"js": "never",
"mjs": "never",
"jsx": "never",
}],
"import/order": ["off", {
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
"newlines-between": "never",
}],
"import/prefer-default-export": "error",
"import/no-restricted-paths": "off",
"import/max-dependencies": ["off", { "max": 10 }],
"import/no-absolute-path": "error",
"import/no-dynamic-require": "off",
"import/no-internal-modules": ["off", {
"allow": [],
}],
"import/unambiguous": "off",
"import/no-webpack-loader-syntax": "error",
"import/no-unassigned-import": "off",
"import/no-named-default": "error",
"import/no-anonymous-default-export": ["off", {
"allowArray": false,
"allowArrowFunction": false,
"allowAnonymousClass": false,
"allowAnonymousFunction": false,
"allowLiteral": false,
"allowObject": false,
}],
"import/exports-last": "off",
"import/group-exports": "off",
"import/no-default-export": "off",
"import/no-self-import": "off",
"accessor-pairs": 2,
"arrow-spacing": 2,
"block-scoped-var": 2,
"block-spacing": [
2,
"always"
],
"brace-style": [
2,
"1tbs",
{
"allowSingleLine": false
}
],
"camelcase": 0,
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "never",
"exports": "never",
"functions": "ignore"
}],
"comma-spacing": [
2,
{
"after": true,
"before": false
}
],
"comma-style": [
2,
"last"
],
"consistent-this": [
2,
"self"
],
"constructor-super": 2,
"curly": 2,
"default-case": 2,
"dot-location": [
2,
"property"
],
"dot-notation": 2,
"eol-last": 2,
"eqeqeq": [
2,
"smart"
],
"generator-star-spacing": ["error", {
"before": false,
"after": true,
"anonymous": {"before": false, "after": true},
"method": {"before": true, "after": true}
}],
"global-require": 0,
"handle-callback-err": 1,
"indent": [
2,
2,
{
"SwitchCase": 1
}
],
"key-spacing": [
2,
{
"afterColon": true,
"beforeColon": false
}
],
"keyword-spacing": [
"error",
{
"after": true,
"before": false,
"overrides": {
"else": { "before": true },
"catch": { "before": true }
}
}
],
"new-cap": 2,
"new-parens": 2,
"no-alert": 1,
"no-array-constructor": 2,
"no-bitwise": 2,
"no-caller": 2,
"no-case-declarations": 0,
"no-catch-shadow": 2,
"no-class-assign": 2,
"no-console": 1,
"no-const-assign": 2,
"no-constant-condition": 2,
"no-continue": 2,
"no-control-regex": 2,
"no-debugger": 1,
"no-delete-var": 2,
"no-div-regex": 1,
"no-dupe-class-members": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-else-return": 2,
"no-empty": 2,
"no-empty-character-class": 2,
"no-eval": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-extra-boolean-cast": 2,
"no-extra-semi": 2,
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-func-assign": 2,
"no-implied-eval": 2,
"no-inner-declarations": 2,
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-iterator": 2,
"no-labels": 2,
"no-lone-blocks": 2,
"no-lonely-if": 2,
"no-loop-func": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-multiple-empty-lines": [
2,
{
"max": 2,
"maxEOF": 1
}
],
"no-native-reassign": 2,
"no-negated-in-lhs": 2,
"no-nested-ternary": 2,
"no-new": 2,
"no-new-func": 2,
"no-new-object": 2,
"no-new-require": 2,
"no-new-wrappers": 2,
"no-octal": 2,
"no-octal-escape": 2,
"no-param-reassign": 2,
"no-proto": 2,
"no-redeclare": 2,
"no-return-assign": 2,
"no-self-compare": 2,
"no-shadow": 2,
"no-shadow-restricted-names": 2,
"no-spaced-func": 2,
"no-this-before-super": 2,
"no-throw-literal": 2,
"no-trailing-spaces": [
2,
{
"skipBlankLines": true
}
],
"no-undef": "error",
"no-undef-init": 2,
"no-unneeded-ternary": 2,
"no-unreachable": 2,
"no-unused-expressions": [
2,
{
"allowShortCircuit": true
}
],
"no-unused-vars": 2,
"no-use-before-define": 2,
"no-useless-call": 2,
"no-useless-concat": 2,
"no-var": 2,
"no-void": 2,
"no-warning-comments": 1,
"no-with": 2,
"object-curly-spacing": [
2,
"always"
],
"prefer-arrow-callback": 0,
"prefer-spread": 1,
"prefer-template": 1,
"quotes": [
2,
"single",
"avoid-escape"
],
"radix": [
2,
"as-needed"
],
"require-yield": 2,
"semi": [
2,
"always"
],
"space-before-blocks": [
2,
"always"
],
"space-before-function-paren": [
2,
{
"anonymous": "always",
"named": "never"
}
],
"space-in-parens": [
"error",
"never"
],
"space-infix-ops": 2,
"space-unary-ops": [
2,
{
"nonwords": false,
"words": true
}
],
"spaced-comment": [
2,
"always"
],
"use-isnan": 2,
"valid-typeof": 2,
"vars-on-top": 2,
"wrap-iife": [
2,
"inside"
],
"yoda": 2
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment