diff --git a/.eslintrc.js b/.eslintrc.js index ada0caa68f..f2ea092043 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,12 +9,12 @@ module.exports = { "eslint:recommended", "plugin:react/recommended", "plugin:flowtype/recommended", - "plugin:react/recommended", "prettier", "prettier/flowtype", "prettier/react" ], "parserOptions": { + "ecmaVersion": "2017", "ecmaFeatures": { "experimentalObjectRestSpread": true, "jsx": true @@ -32,7 +32,48 @@ module.exports = { "import/no-duplicates": "error", "import/no-unresolved": "error", "import/named": "error", - "prettier/prettier": ["error", { singleQuote: true, trailingComma: "es5" }] + "prettier/prettier": ["error", { singleQuote: true, trailingComma: "es5" }], + + "flowtype/no-types-missing-file-annotation": "off", // wait for https://github.com/gajus/eslint-plugin-flowtype/issues/248 + + // overriding recommended rules + "no-constant-condition": ["error", { checkLoops: false }], + "no-console": [ "error", { allow: ["log", "warn", "error"] } ], + + // possible errors + "array-callback-return": "error", + "consistent-return": "error", + // "default-case": "error", // to be enabled after fixing issues in our code + "dot-notation": "error", + "eqeqeq": "error", + // "for-direction": "error", // to be enabled after we upgrade eslint + "no-alert": "error", + "no-caller": "error", + "no-eval": "error", + "no-extend-native": "error", + "no-extra-bind": "error", + "no-extra-label": "error", + "no-implied-eval": "error", + "no-invalid-this": "error", + "no-return-await": "error", + "no-self-compare": "error", + "no-throw-literal": "error", + "no-unmodified-loop-condition": "error", + // "no-unused-expression": "error", // to be enabled after we upgrade eslint + // "no-use-before-define": "error", // to be enabled after fixing issues in our code + "no-useless-call": "error", + "no-useless-computed-key": "error", + "no-useless-concat": "error", + "no-useless-constructor": "error", + "no-useless-rename": "error", + "no-useless-return": "error", + "no-var": "error", + "no-void": "error", + "no-with": "error", + "prefer-const": "error", + // "prefer-promise-reject-errors": "error", // to be enabled after fixing issues in our code + // "prefer-rest-params": "error", // to be enabled after fixing issues in our code + "prefer-spread": "error", }, "settings": { "react": { diff --git a/src/profile-logic/gecko-profile-versioning.js b/src/profile-logic/gecko-profile-versioning.js index 15e6334c67..34e4d017e5 100644 --- a/src/profile-logic/gecko-profile-versioning.js +++ b/src/profile-logic/gecko-profile-versioning.js @@ -59,6 +59,7 @@ function _archFromAbi(abi) { // _upgraders[i] converts from version i - 1 to version i. // Every "upgrader" takes the profile as its single argument and mutates it. +/* eslint-disable no-useless-computed-key */ const _upgraders = { [1]: () => { throw new Error( @@ -184,3 +185,4 @@ const _upgraders = { convertToVersionSixRecursive(profile); }, }; +/* eslint-enable no-useless-computed-key */ diff --git a/src/profile-logic/processed-profile-versioning.js b/src/profile-logic/processed-profile-versioning.js index e9f2466264..5650b21a7d 100644 --- a/src/profile-logic/processed-profile-versioning.js +++ b/src/profile-logic/processed-profile-versioning.js @@ -90,6 +90,7 @@ function _getRealScriptURI(url) { // _upgraders[i] converts from version i - 1 to version i. // Every "upgrader" takes the profile as its single argument and mutates it. +/* eslint-disable no-useless-computed-key */ const _upgraders = { [1]: profile => { // Starting with version 1, markers are sorted. @@ -276,3 +277,4 @@ const _upgraders = { } }, }; +/* eslint-enable no-useless-computed-key */ diff --git a/src/test/fixtures/mocks/canvas-context.js b/src/test/fixtures/mocks/canvas-context.js index 621a793082..ace4dc4703 100644 --- a/src/test/fixtures/mocks/canvas-context.js +++ b/src/test/fixtures/mocks/canvas-context.js @@ -17,7 +17,7 @@ export default function mockCanvasContext() { return jest.fn((...args) => { log.push([name, ...args]); if (fn) { - return fn.apply(null, args); + return fn(...args); } return undefined; }); diff --git a/src/test/store/fixtures/profiles.js b/src/test/store/fixtures/profiles.js index df6ba18c41..0e2a173e44 100644 --- a/src/test/store/fixtures/profiles.js +++ b/src/test/store/fixtures/profiles.js @@ -24,7 +24,7 @@ export function getProfileWithMarkers(markers: TestDefinedMarkers): Profile { data: [], length: 0, }; - markers.map(([name, time, data]) => { + markers.forEach(([name, time, data]) => { markersTable.name.push(stringTable.indexForString(name)); markersTable.time.push(time); markersTable.data.push(data); diff --git a/src/utils/uintarray-encoding.js b/src/utils/uintarray-encoding.js index 416a7b0877..294e27cda7 100644 --- a/src/utils/uintarray-encoding.js +++ b/src/utils/uintarray-encoding.js @@ -8,7 +8,7 @@ */ const encodingChars = - '0123456789abcdefghijklmnopqrstuv' + 'wxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._'; + '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._'; function uintToString(value) { let x = value;