1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Update ESLint

* Bump version
 * Add a couple of rules to match our existing precedent
 * Fix a few genuine lint errors
 * Ignore a guard-for-in (not sure why eslint doesn't like this?)
 * Update max warnings
This commit is contained in:
David Baker
2019-01-09 17:29:30 +00:00
parent f6c8687dc8
commit 68bb8182e4
6 changed files with 486 additions and 607 deletions

View File

@@ -1,7 +1,6 @@
module.exports = { module.exports = {
parser: "babel-eslint",
parserOptions: { parserOptions: {
ecmaVersion: 6, ecmaVersion: 2017,
sourceType: "module", sourceType: "module",
ecmaFeatures: { ecmaFeatures: {
} }
@@ -67,5 +66,11 @@ module.exports = {
"padded-blocks": ["warn"], "padded-blocks": ["warn"],
"no-extend-native": ["warn"], "no-extend-native": ["warn"],
"camelcase": ["warn"], "camelcase": ["warn"],
"no-multi-spaces": ["error", { "ignoreEOLComments": true }],
"space-before-function-paren": ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always",
}],
} }
} }

1072
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,7 @@
"build": "babel -s -d lib src && rimraf dist && mkdir dist && browserify -d browser-index.js | exorcist dist/browser-matrix.js.map > dist/browser-matrix.js && uglifyjs -c -m -o dist/browser-matrix.min.js --source-map dist/browser-matrix.min.js.map --in-source-map dist/browser-matrix.js.map dist/browser-matrix.js", "build": "babel -s -d lib src && rimraf dist && mkdir dist && browserify -d browser-index.js | exorcist dist/browser-matrix.js.map > dist/browser-matrix.js && uglifyjs -c -m -o dist/browser-matrix.min.js --source-map dist/browser-matrix.min.js.map --in-source-map dist/browser-matrix.js.map dist/browser-matrix.js",
"dist": "npm run build", "dist": "npm run build",
"watch": "watchify -d browser-index.js -o 'exorcist dist/browser-matrix.js.map > dist/browser-matrix.js' -v", "watch": "watchify -d browser-index.js -o 'exorcist dist/browser-matrix.js.map > dist/browser-matrix.js' -v",
"lint": "eslint --max-warnings 102 src spec", "lint": "eslint --max-warnings 101 src spec",
"prepublish": "npm run clean && npm run build && git rev-parse HEAD > git-revision.txt" "prepublish": "npm run clean && npm run build && git rev-parse HEAD > git-revision.txt"
}, },
"repository": { "repository": {
@@ -72,7 +72,7 @@
"babel-preset-es2015": "^6.18.0", "babel-preset-es2015": "^6.18.0",
"browserify": "^16.2.3", "browserify": "^16.2.3",
"browserify-shim": "^3.8.13", "browserify-shim": "^3.8.13",
"eslint": "^3.13.1", "eslint": "^5.12.0",
"eslint-config-google": "^0.7.1", "eslint-config-google": "^0.7.1",
"exorcist": "^0.4.0", "exorcist": "^0.4.0",
"expect": "^1.20.2", "expect": "^1.20.2",

View File

@@ -97,7 +97,6 @@ class DiscoveredClientConfig { // eslint-disable-line no-unused-vars
* for users to log in to. * for users to log in to.
*/ */
export class AutoDiscovery { export class AutoDiscovery {
// Dev note: the constants defined here are related to but not // Dev note: the constants defined here are related to but not
// exactly the same as those in the spec. This is to hopefully // exactly the same as those in the spec. This is to hopefully
// translate the meaning of the states in the spec, but also // translate the meaning of the states in the spec, but also

View File

@@ -34,7 +34,6 @@ import utils from "./utils";
* rather than asking the server to do an initial sync on startup. * rather than asking the server to do an initial sync on startup.
*/ */
class SyncAccumulator { class SyncAccumulator {
/** /**
* @param {Object} opts * @param {Object} opts
* @param {Number=} opts.maxTimelineEntries The ideal maximum number of * @param {Number=} opts.maxTimelineEntries The ideal maximum number of

View File

@@ -330,7 +330,7 @@ const deepCompare = module.exports.deepCompare = function(x, y) {
} }
// finally, compare each of x's keys with y // finally, compare each of x's keys with y
for (p in y) { for (p in y) { // eslint-disable-line guard-for-in
if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) { if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {
return false; return false;
} }
@@ -693,7 +693,7 @@ module.exports.globToRegexp = function(glob, extended) {
if (extended) { if (extended) {
pat = pat.replace(/\\\[(!|)(.*)\\]/g, function(match, p1, p2, offset, string) { pat = pat.replace(/\\\[(!|)(.*)\\]/g, function(match, p1, p2, offset, string) {
const first = p1 && '^' || ''; const first = p1 && '^' || '';
const second = p2.replace(/\\\-/, '-'); const second = p2.replace(/\\-/, '-');
return '[' + first + second + ']'; return '[' + first + second + ']';
}); });
} }