From 6daf136eb5f5f857dc06d93cfe8597ee3535ab4f Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 30 Aug 2023 18:52:00 -0400 Subject: [PATCH] feat: explicitly disabled more formatting rules and removed trim-file --- packages/dtslint/dtslint.json | 5 ++ .../eslint-plugin/docs/rules/trim-file.md | 17 ------- packages/eslint-plugin/src/rules/index.ts | 2 - packages/eslint-plugin/src/rules/trim-file.ts | 45 ------------------ packages/eslint-plugin/test/trim-file.test.ts | 46 ------------------- 5 files changed, 5 insertions(+), 110 deletions(-) delete mode 100644 packages/eslint-plugin/docs/rules/trim-file.md delete mode 100644 packages/eslint-plugin/src/rules/trim-file.ts delete mode 100644 packages/eslint-plugin/test/trim-file.test.ts diff --git a/packages/dtslint/dtslint.json b/packages/dtslint/dtslint.json index 87c8b588d3..fca95f90fa 100644 --- a/packages/dtslint/dtslint.json +++ b/packages/dtslint/dtslint.json @@ -79,6 +79,7 @@ "no-string-literal": false, "no-submodule-imports": false, "no-tautology-expression": false, + "no-trailing-whitespace": false, "no-unused-expression": false, "no-unused-variable": false, "no-use-before-declare": false, @@ -88,12 +89,16 @@ "ordered-imports": false, "prefer-function-over-method": false, "quotemark": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, "strict-boolean-expressions": false, "strict-type-predicates": false, "switch-default": false, "trailing-comma": false, "triple-equals": [true, "allow-null-check"], "typedef": false, + "typedef-whitespace": false, "type-literal-delimiter": false, "variable-name": false, "whitespace": false, diff --git a/packages/eslint-plugin/docs/rules/trim-file.md b/packages/eslint-plugin/docs/rules/trim-file.md deleted file mode 100644 index 51b0e51670..0000000000 --- a/packages/eslint-plugin/docs/rules/trim-file.md +++ /dev/null @@ -1,17 +0,0 @@ -# trim-file - -Don't include blank lines at the beginning or end of a file. - -**Bad**: - -```ts - -export function f(): number; - -``` - -**Good**: - -```ts -export function f(): number; -``` diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index e05d684ce2..b18499e465 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -14,7 +14,6 @@ import * as noUnnecessaryGenerics from "./no-unnecessary-generics"; import * as noUselessFiles from "./no-useless-files"; import * as preferDeclareFunction from "./prefer-declare-function"; import * as redundantUndefined from "./redundant-undefined"; -import * as trimFile from "./trim-file"; export const rules = { "dt-header": dtHeader, @@ -33,5 +32,4 @@ export const rules = { "no-useless-files": noUselessFiles, "prefer-declare-function": preferDeclareFunction, "redundant-undefined": redundantUndefined, - "trim-file": trimFile, }; diff --git a/packages/eslint-plugin/src/rules/trim-file.ts b/packages/eslint-plugin/src/rules/trim-file.ts deleted file mode 100644 index 85a275cc5e..0000000000 --- a/packages/eslint-plugin/src/rules/trim-file.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { createRule } from "../util"; - -const rule = createRule({ - name: "trim-file", - defaultOptions: [], - meta: { - type: "layout", - docs: { - description: "Forbids leading/trailing blank lines in a file. Allows file to end in '\n'", - recommended: "error", - }, - messages: { - leadingBlankLine: "File should not begin with a blank line.", - trailingBlankLine: - "File should not end with a blank line. (Ending in one newline OK, ending in two newlines not OK.)", - }, - schema: [], - }, - create(context) { - const { lines, text } = context.getSourceCode(); - if (text.startsWith("\r") || text.startsWith("\n")) { - context.report({ - messageId: "leadingBlankLine", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 0 }, - }, - }); - } - if (text.endsWith("\n\n") || text.endsWith("\r\n\r\n")) { - const line = lines.length; - context.report({ - messageId: "trailingBlankLine", - loc: { - start: { line, column: 0 }, - end: { line, column: 0 }, - }, - }); - } - - return {}; - }, -}); - -export = rule; diff --git a/packages/eslint-plugin/test/trim-file.test.ts b/packages/eslint-plugin/test/trim-file.test.ts deleted file mode 100644 index 1cfcab0dc8..0000000000 --- a/packages/eslint-plugin/test/trim-file.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { ESLintUtils } from "@typescript-eslint/utils"; -import * as trimFile from "../src/rules/trim-file"; - -const ruleTester = new ESLintUtils.RuleTester({ - parser: "@typescript-eslint/parser", -}); - -ruleTester.run("@definitelytyped/trim-file", trimFile, { - invalid: [ - { - code: `\n `, - errors: [ - { - column: 1, - line: 1, - messageId: "leadingBlankLine", - }, - ], - }, - { - code: `0;\n\n`, - errors: [ - { - column: 1, - line: 3, - messageId: "trailingBlankLine", - }, - ], - }, - { - code: `0;\r\n\r\n`, - errors: [ - { - column: 1, - line: 3, - messageId: "trailingBlankLine", - }, - ], - }, - ], - valid: [ - { - code: `let foo = "I am right";\n`, - }, - ], -});