sourcecred/.eslintrc.js
Dandelion Mané f9d62188e4
Add parser for core.Weights (#1877)
This adds a proper parse for core.Weights, and modifies the `fromJSON`
method to use that parser.

This means we now have runtime validation that all Weights files are
actually valid.

Note: I made a tweak to the eslint config so as to allow `_`s in names
when followed by a sequence of numbers, so that types like `Data_0_1_0`
(for including version strings) do not trigger lint failures.

Test plan: All existing tests pass, and I added a new test to validate
that we keep supporting the 0.2.0 format going forward.
2020-06-21 20:58:42 -07:00

55 lines
1.2 KiB
JavaScript

// @flow
module.exports = {
parser: "babel-eslint",
plugins: ["flowtype", "react"],
env: {
browser: true,
es6: true,
node: true,
jest: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:flowtype/recommended",
],
rules: {
"prefer-const": ["warn"],
camelcase: [
"error",
{properties: "never", allow: ["^_unused_.*", "(_\\d+)+"]},
],
eqeqeq: ["error", "always", {null: "ignore"}],
"no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_$|^_unused_",
varsIgnorePattern: "^_$|^_unused_",
caughtErrorsIgnorePattern: "^_$|^_unused_",
},
],
"no-constant-condition": ["warn", {checkLoops: false}],
"no-use-before-define": ["off"],
"no-useless-constructor": ["off"],
"no-case-declarations": ["off"],
"react/prop-types": ["off"],
"flowtype/generic-spacing": ["off"],
"flowtype/space-after-type-colon": ["off"],
},
settings: {
react: {
version: "detect",
},
},
globals: {
BigInt: "readonly",
},
};