tunnckoCore / ideas

:notebook: My centralized place for ideas, thoughts and todos. Raw, PoC implementations and so on... :star:
http://j.mp/1stW47C
6 stars 0 forks source link

backup: full eslint #100

Open tunnckoCore opened 7 years ago

tunnckoCore commented 7 years ago
module.exports = {
  "fp/no-arguments": "error",
  "fp/no-delete": "error",
  "fp/no-events": "error",
  "fp/no-get-set": "error",
  "fp/no-loops": "error",
  "fp/no-mutating-assign": "error",
  "fp/no-mutating-methods": "error",
  "fp/no-mutation": "error",
  "fp/no-rest-parameters": "error",
  "fp/no-throw": "error",
  "fp/no-unused-expression": "error",
  "fp/no-valueof-field": "error",

  "class-methods-use-this": ["error", { "exceptMethods": ["render"] }],
  "consistent-return": "error",
  "consistent-this": ["off", "self"],
  "constructor-super": "error",
  "func-names": ["error", "always"],
  "func-style": ["error", "expression"],
  "func-name-matching": ["error", "always"],

  // applies only on `env: es6`
  "global-require": "error",

  // all the builtins and some commons
  // “There are only two hard things in Computer Science:
  //  cache invalidation and naming things.” — Phil Karlton
  "id-blacklist": [
    "error",
    "err", "error", "callback", "cb",
    "map", "filter", "reduce", "some",  "forEach", "find",
    "first", "second", "last", "nth", "log", "sum",
    "assign", "head", "tail", "take", "drop",
    "arrayify", "isObject", "isNil", "isEven", "isOdd", "typeOf",
    "curryN", "curry1", "curry2", "curry3", "append", "prepend"
    "flatten", "flatMap", "join", "split", "reverse"
    "and", "both", "or", "either", "Maybe", "Either"
    "pipe", "compose"
  ],

  // always follow some meaningful naming conventions
  // “There are only two hard things in Computer Science:
  //  cache invalidation and naming things.” — Phil Karlton
  "id-length": ["error", {
    "min": 3,
    "max": 15,
    "properties": "always",
    "exceptions": ["x", "y", "z", "i", "j", "_", "a", "b", "c"]
  }],

  // camelCase preferred, but allow `__dirname` and such
  "id-match": ["error", "^[a-z]+([A-Z][a-z]+)*$", { "onlyDeclarations": true }],

  "jsx-quotes": ["error", "prefer-double"],
  "indent": ["error", 2],
  "init-declarations": ["error", "always"],

  "key-spacing": ["error", { "beforeColon": false,"afterColon": true }],
  "keyword-spacing": "error",
  "line-comment-position": "off",
  "linebreak-style": ["warn", "unix"],
  "lines-around-comment": ["error", {
    "beforeBlockComment": true,
    "afterBlockComment": false,
    "beforeLineComment": true,
    "afterLineComment": true,
    "allowBlockStart": true,
    "allowBlockEnd": false,
    "allowObjectStart": true,
    "allowObjectEnd": false,
    "allowArrayStart": true,
    "allowArrayEnd": false,
    "applyDefaultIgnorePatterns": true
  }],

  "yield-star-spacing": ["error", {"before": true, "after": true}],
  "template-curly-spacing": ["error", "always"],
  "template-tag-spacing": ["error", "never"],
  "generator-star-spacing": ["error", { "before": false, "after": true }],
  "computed-property-spacing": ["error", "never"],
  "object-curly-spacing": ["error", "always"],
  "space-before-function-paren": ["error", "always"],

  "no-var": "error",
  "no-let": "error",
  "prefer-const": "error",
  "prefer-destructuring": "warn",
  "prefer-arrow-callback": ["error", { "allowNamedFunctions": true }],
  "arrow-parens": ["error", "always"],
  "arrow-body-style": [
    "error",
    "as-needed",
    { "requireReturnForObjectLiteral": false },
  ],

  "max-params": ["error", { "max": 3 }],
  "max-statements": ["error", { "max": 10 }],
  "max-statements-per-line": "error",
  "max-nested-callbacks": ["error", { "max": 3 }],
  "max-depth": ["error", { "max": 3 }],
  "max-len": [
    "error",
    {
      "code": 100,
      "ignoreTemplateLiterals": true,
      "ignoreComments": false,
      "ignoreStrings": true,
      "ignoreUrls": true,
    },
  ],
  // please, modularize!
  "max-lines": ["error", {
      "max": 200,
      "skipBlankLines": true,
      "skipComments": true
  }],

  "no-empty": ["error", { "allowEmptyCatch": true }],
  "no-use-before-define": [
    "warn",
    { "functions": false, "classes": true, "variables": true },
  ],

  "unicode-bom": ["error", "never"],
  "use-isnan": "error",
  "valid-typeof": "error"

  "import/default": "error",
  "import/export": "error",
  "import/extensions": "off",
  // Using more than 10 dependencies in one module is a sign
  // that this module is doing too much.
  // You should consider splitting that module into different parts.
  "import/max-dependencies": ["error", { "max": 10 }],
  "import/newline-after-import": ["error", { "count": 1 }],

  "import/named": "error",
  "import/namespace": "error",
  "import/no-extraneous-dependencies": "error",
  "import/no-unresolved": ["error", { "commonjs": true }],
  "import/no-absolute-path": "error",

  // use ES Modules (and dynamic import), always and everywhere
  "import/no-amd": "error",

  // allow commonjs `require`s in ESM,
  // because sometimes it's useful and/or there's no other way
  "import/no-commonjs": "off",

  "import/no-dynamic-require": "warn",
  "import/no-deprecated": "off",
  "import/no-internal-modules": "off",
  "import/no-mutable-exports": "error",

  "no-func-assign": "error",
  "no-class-assign": "error",

  "import/no-named-as-default": "error",
  "import/no-named-as-default-member": "error",
  "import/no-named-default": "error",
  "import/no-namespace": "off",
  "import/no-nodejs-modules": "off",
  "import/no-unassigned-import": "warn",
  "import/no-unresolved": ["error", { "commonjs": true }],
  "import/no-webpack-loader-syntax": "error",
  "import/order": "error",
  "import/prefer-default-export": "error",
  "import/unambiguous": "warn",

  // follow naming conventions
  "import/no-anonymous-default-export": ["error", {
    "allowArrowFunction": true
  }],

  "import/no-duplicates": "error"
  "no-duplicate-imports": ["error", { "includeExports": true }],

  "jsdoc/check-param-names": "error",
  "jsdoc/check-tag-names": "error",
  "jsdoc/check-types": "error",
  "jsdoc/newline-after-description": "error",
  "jsdoc/require-description-complete-sentence": "off",
  "jsdoc/require-hyphen-before-param-description": "error",
  "jsdoc/require-param": "error",
  "jsdoc/require-param-description": "error",
  "jsdoc/require-param-type": "error",
  "jsdoc/require-returns-description": "off",
  "jsdoc/require-returns-type": "error",

  "valid-jsdoc": ["error", {
    "prefer": {
      "arg": "param",
      "argument": "param",
      "class": "constructor",
      "return": "returns",
      "virtual": "abstract"
    },
    "preferType": {
      "Boolean": "boolean",
      "Object": "object",
      "String": "string",
      "Array": "array",
      "Any": "any",
      "Number": "number",
      "function": "Function",
      "promise": "Promise",
      "map": "Map",
      "weakmap": "WeakMap",
      "weakMap": "WeakMap",
      "set": "Set",
      "weakset": "WeakSet",
      "weakSet": "WeakSet",
      "Void": "void",
      "undefined": "void",
      "Null": "null",
    },
    "requireParamDescription": true,
    "requireReturn": false, // if and only if the function or method has a `return` statement
    "requireReturnDescription": false
    "requireReturnType": true,
  }],

  "flowtype/boolean-style": ["error", "boolean"],

  "flowtype/no-primitive-constructor-types": "error",
  "flowtype/no-weak-types": ["error", {
    "any": false,
    "Function": false
  }],

  "flowtype/object-type-delimiter": ["error", "comma"],
  "flowtype/delimiter-dangle": ["error", "always-multiline"],
  "comma-dangle": [
    "error",
    {
      "arrays": "always-multiline",
      "objects": "always-multiline",
      "imports": "always-multiline",
      "exports": "always-multiline",
      "functions": "always-multiline"
    },
  ],

  "flowtype/type-id-match": ["error", "^([A-Z][a-z0-9]*)+Type$"],
  "flowtype/union-intersection-spacing": ["error", "always"],

  "flowtype/space-after-type-colon": ["error", "always"],
  "flowtype/space-before-type-colon": ["error", "never"],
  "flowtype/space-before-generic-bracket": ["error", "never"],
  "flowtype/require-valid-file-annotation": ["error", "always"],

  "flowtype/no-dupe-keys": "error",
  "flowtype/no-types-missing-file-annotation": "off",

  "flowtype/semi": ["error", "always"],
  "semi": ["error", "always"],

  // "cleanjs/no-nil": [
  //   "error",
  //   {
  //     "explicitReturn": false
  //   }
  // ]
}
tunnckoCore commented 7 years ago

more

/*

  "fp/no-arguments": "error",
  "fp/no-delete": "error",
  "fp/no-events": "error",
  "fp/no-get-set": "error",
  "fp/no-loops": "error",
  "fp/no-mutating-assign": "error",
  "fp/no-mutating-methods": "error",
  "fp/no-mutation": "error",
  "fp/no-rest-parameters": "error",
  "fp/no-throw": "error",
  "fp/no-unused-expression": "error",
  "fp/no-valueof-field": "error",

  "class-methods-use-this": ["error", { "exceptMethods": ["render"] }],
  "consistent-return": "error",
  "consistent-this": ["off", "self"],
  "constructor-super": "error",
  "func-names": ["error", "always"],
  "func-style": ["error", "expression"],
  "func-name-matching": ["error", "always"],

  // applies only on `env: es6`
  "global-require": "error",

  // all the builtins and some commons
  // “There are only two hard things in Computer Science:
  //  cache invalidation and naming things.” — Phil Karlton
  "id-blacklist": [
    "error",
    "err", "error", "callback", "cb",
    "map", "filter", "reduce", "some",  "forEach", "find",
    "first", "second", "last", "nth", "log", "sum",
    "assign", "head", "tail", "take", "drop",
    "arrayify", "isObject", "isNil", "isEven", "isOdd", "typeOf",
    "curryN", "curry1", "curry2", "curry3", "append", "prepend"
    "flatten", "flatMap", "join", "split", "reverse"
    "and", "both", "or", "either", "Maybe", "Either"
    "pipe", "compose"
  ],

  // always follow some meaningful naming conventions
  // “There are only two hard things in Computer Science:
  //  cache invalidation and naming things.” — Phil Karlton
  "id-length": ["error", {
    "min": 3,
    "max": 15,
    "properties": "always",
    "exceptions": ["x", "y", "z", "i", "j", "_", "a", "b", "c"]
  }],

  // camelCase preferred, but allow `__dirname` and such
  "id-match": ["error", "^[a-z]+([A-Z][a-z]+)*$", { "onlyDeclarations": true }],

  "jsx-quotes": ["error", "prefer-double"],
  "indent": ["error", 2],
  "init-declarations": ["error", "always"],

  "key-spacing": ["error", { beforeColon: false, afterColon: true }],
  "keyword-spacing": "error",
  "line-comment-position": "off",
  "linebreak-style": ["warn", "unix"],
  "lines-around-comment": ["error", {
    "beforeBlockComment": true,
    "afterBlockComment": false,
    "beforeLineComment": true,
    "afterLineComment": true,
    "allowBlockStart": true,
    "allowBlockEnd": false,
    "allowObjectStart": true,
    "allowObjectEnd": false,
    "allowArrayStart": true,
    "allowArrayEnd": false,
    "applyDefaultIgnorePatterns": true
  }],

  "yield-star-spacing": ["error", {"before": true, "after": true}],
  "template-curly-spacing": ["error", "always"],
  "template-tag-spacing": ["error", "never"],
  "generator-star-spacing": ["error", { "before": false, "after": true }],
  "computed-property-spacing": ["error", "never"],
  "object-curly-spacing": ["error", "always"],
  "space-before-function-paren": ["error", "always"],

  "no-var": "error",
  "no-let": "error",
  "prefer-const": "error",
  "prefer-destructuring": "warn",
  "prefer-arrow-callback": ["error", { "allowNamedFunctions": true }],
  "arrow-parens": ["error", "always"],
  "arrow-body-style": [
    "error",
    "as-needed",
    { "requireReturnForObjectLiteral": false },
  ],

  "max-params": ["error", { "max": 3 }],
  "max-statements": ["error", { "max": 10 }],
  "max-statements-per-line": "error",
  "max-nested-callbacks": ["error", { "max": 3 }],
  "max-depth": ["error", { "max": 3 }],
  "max-len": [
    "error",
    {
      "code": 100,
      "ignoreTemplateLiterals": true,
      "ignoreComments": false,
      "ignoreStrings": true,
      "ignoreUrls": true,
    },
  ],
  // please, modularize!
  "max-lines": ["error", {
      "max": 200,
      "skipBlankLines": true,
      "skipComments": true
  }],

  "no-empty": ["error", { "allowEmptyCatch": true }],
  "no-use-before-define": [
    "warn",
    { "functions": false, "classes": true, "variables": true },
  ],

  "unicode-bom": ["error", "never"],
  "use-isnan": "error",
  "valid-typeof": "error"

  "import/default": "error",
  "import/export": "error",
  "import/extensions": "off",
  // Using more than 10 dependencies in one module is a sign
  // that this module is doing too much.
  // You should consider splitting that module into different parts.
  "import/max-dependencies": ["error", { max: 10 }],
  "import/newline-after-import": ["error", { count: 1 }],

  "import/named": "error",
  "import/namespace": "error",
  "import/no-extraneous-dependencies": "error",
  "import/no-unresolved": ["error", { commonjs: true }],
  "import/no-absolute-path": "error",

  // use ES Modules (and dynamic import), always and everywhere
  "import/no-amd": "error",

  // allow commonjs `require`s in ESM,
  // because sometimes it's useful and/or there's no other way
  "import/no-commonjs": "off",

  "import/no-dynamic-require": "warn",
  "import/no-deprecated": "off",
  "import/no-internal-modules": "off",
  "import/no-mutable-exports": "error",

  "no-func-assign": "error",
  "no-class-assign": "error",

  "import/no-named-as-default": "error",
  "import/no-named-as-default-member": "error",
  "import/no-named-default": "error",
  "import/no-namespace": "off",
  "import/no-nodejs-modules": "off",
  "import/no-unassigned-import": "warn",
  "import/no-unresolved": ["error", { commonjs: true }],
  "import/no-webpack-loader-syntax": "error",
  "import/order": "error",
  "import/prefer-default-export": "error",
  "import/unambiguous": "warn",

  // follow naming conventions
  "import/no-anonymous-default-export": ["error", {
    "allowArrowFunction": true
  }],

  "import/no-duplicates": "error"
  "no-duplicate-imports": ["error", { "includeExports": true }],

  "jsdoc/check-param-names": "error",
  "jsdoc/check-tag-names": "error",
  "jsdoc/check-types": "error",
  "jsdoc/newline-after-description": "error",
  "jsdoc/require-description-complete-sentence": "off",
  "jsdoc/require-hyphen-before-param-description": "error",
  "jsdoc/require-param": "error",
  "jsdoc/require-param-description": "error",
  "jsdoc/require-param-type": "error",
  "jsdoc/require-returns-description": "off",
  "jsdoc/require-returns-type": "error",

  "valid-jsdoc": ["error", {
    "prefer": {
      "arg": "param",
      "argument": "param",
      "class": "constructor",
      "return": "returns",
      "virtual": "abstract"
    },
    "preferType": {
      "Boolean": "boolean",
      "Object": "object",
      "String": "string",
      "Array": "array",
      "Any": "any",
      "Number": "number",
      "function": "Function",
      "promise": "Promise",
      "map": "Map",
      "weakmap": "WeakMap",
      "weakMap": "WeakMap",
      "set": "Set",
      "weakset": "WeakSet",
      "weakSet": "WeakSet",
      "Void": "void",
      "undefined": "void",
      "Null": "null",
    },
    "requireParamDescription": true,
    "requireReturn": false, // if and only if the function or method has a `return` statement
    "requireReturnDescription": false
    "requireReturnType": true,
  }],

  "flowtype/boolean-style": ["error, "boolean"],

  "flowtype/no-primitive-constructor-types": "error",
  "flowtype/no-weak-types": ["error", {
    "any": false,
    "Function": false
  }],

  "flowtype/object-type-delimiter": ["error, "comma"],
  "flowtype/delimiter-dangle": ["error, "always-multiline"],
  "comma-dangle": [
    "error",
    {
      "arrays": "always-multiline",
      "objects": "always-multiline",
      "imports": "always-multiline",
      "exports": "always-multiline",
      "functions": "always-multiline"
    },
  ],

  "flowtype/type-id-match": ["error", "^([A-Z][a-z0-9]*)+Type$"],
  "flowtype/union-intersection-spacing": ["error", "always"],

  "flowtype/space-after-type-colon": ["error", "always"],
  "flowtype/space-before-type-colon": ["error", "never"],
  "flowtype/space-before-generic-bracket": ["error", "never"],
  "flowtype/require-valid-file-annotation": ["error", "always"],

  "flowtype/no-dupe-keys": "error",
  "flowtype/no-types-missing-file-annotation": "off",

  "flowtype/semi": ["error, "always"],
  "semi": ["error", "always"],

  "cleanjs/no-nil": [
    "error",
    {
      "explicitReturn": false
    }
  ]

*/
tunnckoCore commented 7 years ago

todo: post on fb

Здравейте :)

Малко бекграунд: Занимавам се с Nodejs доста сериозно от 3+ години и публикувам пакети, и съответно ги мейнтейнвам - 
някои къде доста зарязани, други доста стабилни с години светещи с зелени баджове от тонове сървиси за testing & 
quality (разбирай Travis, AppVeyor, CodeClimate, Coveralls/CodeCov, NodeSecurity Project, StandardJS/Eslint и Prettier 
от day one). До този момент са около 300. Официално се водят 340, но да. Всички са с MIT лиценз, тестове, документаци и 
всичко на макс. През годините съм имал доста предложения за работа и в чужбина, и в България. Не ги пиша и публикувам 
просто „ей така“ и доста от тях се използват на доста места.
Всички общо тегления са ~108млн. и ~10млн. за последния месец, като през последните месеци месечните тегления се качват 
с около 30-40%.

Та, за пореден път се замислям над лицензите. И за пореден път прекарвам доста часове из тях четейки ги.

За първи път обаче, се замислям по-сериозно над GPL и по-специфично LGPL. Обаче има нещо, с което не съм много 
съгласен. И то не че не съм съгласен, ами е недостатъчно според мен. Този лиценз позволява всичко, стига да 
tunnckoCore commented 7 years ago

global ~/.yarnrc

# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1

lastUpdateCheck 1508536243112
yarn-offline-mirror "/home/charlike/.yarn/offline"
yarn-offline-mirror-pruning true