Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update server monorepo to ESLint 7 #3851

Merged
merged 7 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1,525 changes: 1,287 additions & 238 deletions server/routerlicious/lerna-package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions server/routerlicious/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"postinstall": "npm run postinstall:lerna",
"lint": "lerna run lint --no-sort --stream",
"lint:fix": "lerna run lint:fix --no-sort --stream",
"lint:strict": "lerna run lint --stream -- -- -- --report-unused-disable-directives",
"policy-check": "fluid-repo-policy-check",
"policy-check:fix": "fluid-repo-policy-check -r",
"post-lerna-install:default": "[ -f package-lock.json ] && mv package-lock.json lerna-package-lock.json; [ -f package-lock.json.bak ] && mv package-lock.json.bak package-lock.json; exit 0",
Expand Down
4 changes: 2 additions & 2 deletions server/routerlicious/packages/gitresources/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

module.exports = {
"extends": [
"@fluidframework/eslint-config-fluid"
"@fluidframework/eslint-config-fluid/eslint7"
],
"rules": {}
}
}
22 changes: 11 additions & 11 deletions server/routerlicious/packages/gitresources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@
"build:full": "npm run build",
"build:full:compile": "npm run build:compile",
"clean": "rimraf dist *.tsbuildinfo *.build.log",
"eslint": "eslint --ext=ts,tsx --format stylish src",
"eslint": "eslint --format stylish src",
"eslint:fix": "eslint --ext=ts,tsx --format stylish src --fix",
"lint": "npm run eslint",
"lint:fix": "npm run eslint:fix",
"tsc": "tsc",
"tsfmt": "tsfmt --verify",
"tsfmt:fix": "tsfmt --replace"
},
"dependencies": {},
"devDependencies": {
"@fluidframework/build-common": "^0.19.2",
"@fluidframework/eslint-config-fluid": "^0.19.1",
"@typescript-eslint/eslint-plugin": "~2.17.0",
"@typescript-eslint/parser": "~2.17.0",
"@fluidframework/eslint-config-fluid": "^0.20.0-0",
"@typescript-eslint/eslint-plugin": "~4.2.0",
"@typescript-eslint/parser": "~4.2.0",
"concurrently": "^5.2.0",
"eslint": "~6.8.0",
"eslint-plugin-eslint-comments": "~3.1.2",
"eslint-plugin-import": "2.20.0",
"eslint": "~7.9.0",
"eslint-plugin-eslint-comments": "~3.2.0",
"eslint-plugin-import": "~2.22.0",
"eslint-plugin-no-null": "~1.0.2",
"eslint-plugin-optimize-regex": "~1.1.7",
"eslint-plugin-prefer-arrow": "~1.1.7",
"eslint-plugin-react": "~7.18.0",
"eslint-plugin-unicorn": "~15.0.1",
"eslint-plugin-prefer-arrow": "~1.2.2",
"eslint-plugin-react": "~7.21.2",
"eslint-plugin-unicorn": "~22.0.0",
"rimraf": "^2.6.2",
"typescript": "~3.8.2",
"typescript-formatter": "7.1.0"
Expand Down
8 changes: 5 additions & 3 deletions server/routerlicious/packages/kafka-orderer/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

module.exports = {
"extends": [
"@fluidframework/eslint-config-fluid"
"@fluidframework/eslint-config-fluid/eslint7"
],
"rules": {}
}
"rules": {
"@typescript-eslint/strict-boolean-expressions": "off", // requires strictNullChecks=true in tsconfig
}
}
21 changes: 10 additions & 11 deletions server/routerlicious/packages/kafka-orderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build:full": "npm run build",
"build:full:compile": "npm run build:compile",
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
"eslint": "eslint --ext=ts,tsx --format stylish src",
"eslint": "eslint --format stylish src",
"eslint:fix": "eslint --ext=ts,tsx --format stylish src --fix",
"lint": "npm run eslint",
"lint:fix": "npm run eslint:fix",
Expand All @@ -29,18 +29,17 @@
},
"devDependencies": {
"@fluidframework/build-common": "^0.19.2",
"@fluidframework/eslint-config-fluid": "^0.19.1",
"@typescript-eslint/eslint-plugin": "~2.17.0",
"@typescript-eslint/parser": "~2.17.0",
"@fluidframework/eslint-config-fluid": "^0.20.0-0",
"@typescript-eslint/eslint-plugin": "~4.2.0",
"@typescript-eslint/parser": "~4.2.0",
"concurrently": "^5.2.0",
"eslint": "~6.8.0",
"eslint-plugin-eslint-comments": "~3.1.2",
"eslint-plugin-import": "2.20.0",
"eslint": "~7.9.0",
"eslint-plugin-eslint-comments": "~3.2.0",
"eslint-plugin-import": "~2.22.0",
"eslint-plugin-no-null": "~1.0.2",
"eslint-plugin-optimize-regex": "~1.1.7",
"eslint-plugin-prefer-arrow": "~1.1.7",
"eslint-plugin-react": "~7.18.0",
"eslint-plugin-unicorn": "~15.0.1",
"eslint-plugin-prefer-arrow": "~1.2.2",
"eslint-plugin-react": "~7.21.2",
"eslint-plugin-unicorn": "~22.0.0",
"rimraf": "^2.6.2",
"typescript": "~3.8.2",
"typescript-formatter": "7.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,8 @@ export class KafkaOrdererConnection implements core.IOrdererConnection {
// Add trace
messages.forEach((message) => {
const operation = message.operation;
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (operation && operation.traces === undefined) {
operation.traces = [];
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
} else if (operation && operation.traces && operation.traces.length > 1) {
operation.traces.push(
{
Expand Down
2 changes: 1 addition & 1 deletion server/routerlicious/packages/kafka-orderer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"include": [
"src/**/*"
]
}
}
4 changes: 2 additions & 2 deletions server/routerlicious/packages/lambdas-driver/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

module.exports = {
"extends": [
"@fluidframework/eslint-config-fluid"
"@fluidframework/eslint-config-fluid/eslint7"
],
"rules": {
"@typescript-eslint/strict-boolean-expressions": "off"
}
}
}
21 changes: 10 additions & 11 deletions server/routerlicious/packages/lambdas-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build:full": "npm run build",
"build:full:compile": "npm run build:compile",
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
"eslint": "eslint --ext=ts,tsx --format stylish src",
"eslint": "eslint --format stylish src",
"eslint:fix": "eslint --ext=ts,tsx --format stylish src --fix",
"lint": "npm run eslint",
"lint:fix": "npm run eslint:fix",
Expand Down Expand Up @@ -58,24 +58,23 @@
},
"devDependencies": {
"@fluidframework/build-common": "^0.19.2",
"@fluidframework/eslint-config-fluid": "^0.19.1",
"@fluidframework/eslint-config-fluid": "^0.20.0-0",
"@fluidframework/server-test-utils": "^0.1016.0",
"@types/async": "^2.0.50",
"@types/lodash": "^4.14.118",
"@types/mocha": "^5.2.5",
"@types/nconf": "^0.0.37",
"@types/node": "^10.17.24",
"@typescript-eslint/eslint-plugin": "~2.17.0",
"@typescript-eslint/parser": "~2.17.0",
"@typescript-eslint/eslint-plugin": "~4.2.0",
"@typescript-eslint/parser": "~4.2.0",
"concurrently": "^5.2.0",
"eslint": "~6.8.0",
"eslint-plugin-eslint-comments": "~3.1.2",
"eslint-plugin-import": "2.20.0",
"eslint": "~7.9.0",
"eslint-plugin-eslint-comments": "~3.2.0",
"eslint-plugin-import": "~2.22.0",
"eslint-plugin-no-null": "~1.0.2",
"eslint-plugin-optimize-regex": "~1.1.7",
"eslint-plugin-prefer-arrow": "~1.1.7",
"eslint-plugin-react": "~7.18.0",
"eslint-plugin-unicorn": "~15.0.1",
"eslint-plugin-prefer-arrow": "~1.2.2",
"eslint-plugin-react": "~7.21.2",
"eslint-plugin-unicorn": "~22.0.0",
"mocha": "^8.1.1",
"nyc": "^15.0.0",
"rimraf": "^2.6.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { DocumentLambdaFactory } from "./lambdaFactory";
export * from "./lambdaFactory";

export async function create(config: Provider): Promise<IPartitionLambdaFactory> {
// eslint-disable-next-line @typescript-eslint/ban-types
const pluginConfig = config.get("documentLambda") as string | object;
// eslint-disable-next-line @typescript-eslint/no-require-imports
const plugin = (typeof pluginConfig === "object" ? pluginConfig : require(pluginConfig)) as IPlugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export class Partition extends EventEmitter {
this.q.kill();
});

// eslint-disable-next-line @typescript-eslint/unbound-method
this.q.error = (error) => {
this.emit("error", error, true);
};
Expand Down
2 changes: 1 addition & 1 deletion server/routerlicious/packages/lambdas-driver/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"include": [
"src/**/*"
]
}
}
7 changes: 4 additions & 3 deletions server/routerlicious/packages/lambdas/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

module.exports = {
"extends": [
"@fluidframework/eslint-config-fluid"
"@fluidframework/eslint-config-fluid/eslint7"
],
"rules": {
"@typescript-eslint/strict-boolean-expressions": "off"
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
}
}
}
21 changes: 10 additions & 11 deletions server/routerlicious/packages/lambdas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build:full": "npm run build",
"build:full:compile": "npm run build:compile",
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
"eslint": "eslint --ext=ts,tsx --format stylish src",
"eslint": "eslint --format stylish src",
"eslint:fix": "eslint --ext=ts,tsx --format stylish src --fix",
"lint": "npm run eslint",
"lint:fix": "npm run eslint:fix",
Expand Down Expand Up @@ -67,7 +67,7 @@
},
"devDependencies": {
"@fluidframework/build-common": "^0.19.2",
"@fluidframework/eslint-config-fluid": "^0.19.1",
"@fluidframework/eslint-config-fluid": "^0.20.0-0",
"@fluidframework/server-test-utils": "^0.1016.0",
"@types/async": "^2.0.50",
"@types/json-stringify-safe": "^5.0.0",
Expand All @@ -76,17 +76,16 @@
"@types/nconf": "^0.0.37",
"@types/node": "^10.17.24",
"@types/webpack": "^4.41.2",
"@typescript-eslint/eslint-plugin": "~2.17.0",
"@typescript-eslint/parser": "~2.17.0",
"@typescript-eslint/eslint-plugin": "~4.2.0",
"@typescript-eslint/parser": "~4.2.0",
"concurrently": "^5.2.0",
"eslint": "~6.8.0",
"eslint-plugin-eslint-comments": "~3.1.2",
"eslint-plugin-import": "2.20.0",
"eslint": "~7.9.0",
"eslint-plugin-eslint-comments": "~3.2.0",
"eslint-plugin-import": "~2.22.0",
"eslint-plugin-no-null": "~1.0.2",
"eslint-plugin-optimize-regex": "~1.1.7",
"eslint-plugin-prefer-arrow": "~1.1.7",
"eslint-plugin-react": "~7.18.0",
"eslint-plugin-unicorn": "~15.0.1",
"eslint-plugin-prefer-arrow": "~1.2.2",
"eslint-plugin-react": "~7.21.2",
"eslint-plugin-unicorn": "~22.0.0",
"mocha": "^8.1.1",
"nyc": "^15.0.0",
"rimraf": "^2.6.2",
Expand Down
3 changes: 2 additions & 1 deletion server/routerlicious/packages/lambdas/src/deli/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class DeliLambda implements IPartitionLambda {
private idleTimer: any;
private noopTimer: any;
private noActiveClients = false;
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
private canClose = false;

Expand Down Expand Up @@ -547,6 +547,7 @@ export class DeliLambda implements IPartitionLambda {
if (isSystemType(message.operation.type)) {
const operation = message.operation as IDocumentSystemMessage;
if (operation.data) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(operation.data);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ export class ScriptoriumLambda implements IPartitionLambda {
private async insertOp(messages: ISequencedOperationMessage[]) {
return this.opCollection
.insertMany(messages, false)
// eslint-disable-next-line @typescript-eslint/promise-function-async
.catch((error) => {
.catch(async (error) => {
// Duplicate key errors are ignored since a replay may cause us to insert twice into Mongo.
// All other errors result in a rejected promise.
if (error.code !== 11000) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export abstract class SequencedLambda implements IPartitionLambda {
});
}, 1);

// eslint-disable-next-line @typescript-eslint/unbound-method
this.q.error = (error) => {
const documentError = {
documentId: this.documentId,
Expand Down
2 changes: 1 addition & 1 deletion server/routerlicious/packages/lambdas/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"include": [
"src/**/*"
]
}
}
8 changes: 5 additions & 3 deletions server/routerlicious/packages/local-server/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

module.exports = {
"extends": [
"@fluidframework/eslint-config-fluid"
"@fluidframework/eslint-config-fluid/eslint7"
],
"rules": {}
}
"rules": {
"@typescript-eslint/strict-boolean-expressions": "off", // requires strictNullChecks=true in tsconfig
}
}
21 changes: 10 additions & 11 deletions server/routerlicious/packages/local-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build:full:compile": "npm run build:compile",
"build:genver": "gen-version",
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
"eslint": "eslint --ext=ts,tsx --format stylish src",
"eslint": "eslint --format stylish src",
"eslint:fix": "eslint --ext=ts,tsx --format stylish src --fix",
"lint": "npm run eslint",
"lint:fix": "npm run eslint:fix",
Expand Down Expand Up @@ -62,24 +62,23 @@
},
"devDependencies": {
"@fluidframework/build-common": "^0.19.2",
"@fluidframework/eslint-config-fluid": "^0.19.1",
"@fluidframework/eslint-config-fluid": "^0.20.0-0",
"@types/jsrsasign": "^8.0.8",
"@types/mocha": "^5.2.5",
"@types/nock": "^9.3.0",
"@types/node": "^10.17.24",
"@types/webpack": "^4.41.2",
"@typescript-eslint/eslint-plugin": "~2.17.0",
"@typescript-eslint/parser": "~2.17.0",
"@typescript-eslint/eslint-plugin": "~4.2.0",
"@typescript-eslint/parser": "~4.2.0",
"concurrently": "^5.2.0",
"copyfiles": "^2.1.0",
"eslint": "~6.8.0",
"eslint-plugin-eslint-comments": "~3.1.2",
"eslint-plugin-import": "2.20.0",
"eslint": "~7.9.0",
"eslint-plugin-eslint-comments": "~3.2.0",
"eslint-plugin-import": "~2.22.0",
"eslint-plugin-no-null": "~1.0.2",
"eslint-plugin-optimize-regex": "~1.1.7",
"eslint-plugin-prefer-arrow": "~1.1.7",
"eslint-plugin-react": "~7.18.0",
"eslint-plugin-unicorn": "~15.0.1",
"eslint-plugin-prefer-arrow": "~1.2.2",
"eslint-plugin-react": "~7.21.2",
"eslint-plugin-unicorn": "~22.0.0",
"mocha": "^8.1.1",
"mocha-junit-reporter": "^1.18.0",
"nock": "^10.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ describe("Local server", () => {
it("Isomorphic check - webpack build", async () => {
return new Promise((resolve, reject) => {
webpack(config, (err, stats) => {
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (err) {
assert.fail(err);
reject();
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
} else if (stats.hasErrors()) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
assert.fail(stats.compilation.errors.map((value) => value.stack).join("\n"));
reject();
} else {
Expand Down
2 changes: 1 addition & 1 deletion server/routerlicious/packages/local-server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"include": [
"src/**/*"
]
}
}