Rename rome-ignore-next-statement to rome-ignore-next
MODIFY
packages/@romejs/diagnostics/descriptions.ts
packages/@romejs/diagnostics/descriptions.ts
@@ -783,16 +783,11 @@ export const descriptions = createMessages({
},
SUPPRESSIONS: {
UNUSED: (suppression: DiagnosticSuppression) => {
- let description = {
- next: 'next line',
- current: 'current line',
- statement: 'next statement',
- }[suppression.type];
-
+ let description = '';
if (suppression.startLine === suppression.endLine) {
- description += ` line ${suppression.startLine}`;
+ description = `line ${suppression.startLine}`;
} else {
- description += ` lines ${suppression.startLine}-${suppression.endLine}`;
+ description += `lines ${suppression.startLine} to ${suppression.endLine}`;
}
return {
@@ -802,7 +797,7 @@ export const descriptions = createMessages({
{
type: 'log',
category: 'info',
- text: `This suppression prefixes hides the <emphasis>${description}</emphasis>`,
+ text: `This suppression should hide <emphasis>${description}</emphasis>`,
},
],
};

MODIFY
packages/@romejs/diagnostics/types.ts
packages/@romejs/diagnostics/types.ts
@@ -24,10 +24,7 @@ export type DiagnosticFilter = {
export type DiagnosticFilters = Array<DiagnosticFilter>;
-export type DiagnosticSuppressionType = 'next' | 'current' | 'statement';
-
export type DiagnosticSuppression = {
- type: DiagnosticSuppressionType;
filename: string;
category: string;
startLine: Number1;

MODIFY
packages/@romejs/js-compiler/suppressions.ts
packages/@romejs/js-compiler/suppressions.ts
@@ -9,7 +9,6 @@ import {AnyComment, AnyNode, Program} from '@romejs/js-ast';
import {
DiagnosticLocation,
DiagnosticSuppression,
- DiagnosticSuppressionType,
DiagnosticSuppressions,
Diagnostics,
descriptions,
@@ -21,13 +20,13 @@ import Path from './lib/Path';
export const SUPPRESSION_NEXT_LINE_START = 'rome-ignore-next-line';
const SUPPRESSION_CURRENT_LINE_START = 'rome-ignore-line';
-const SUPPRESSION_NEXT_STATEMENT_START = 'rome-ignore-next-statement';
+const SUPPRESSION_NEXT_NODE_START = 'rome-ignore-next';
const prefixMistakes: Dict<string> = {
disable: SUPPRESSION_NEXT_LINE_START,
suppress: SUPPRESSION_NEXT_LINE_START,
ignore: SUPPRESSION_NEXT_LINE_START,
- 'next-statement': SUPPRESSION_NEXT_STATEMENT_START,
+ next: SUPPRESSION_NEXT_NODE_START,
'next-line': SUPPRESSION_NEXT_LINE_START,
line: SUPPRESSION_CURRENT_LINE_START,
'current-line': SUPPRESSION_CURRENT_LINE_START,
@@ -114,21 +113,16 @@ function extractSuppressionsFromComment(
let matchedPrefix: undefined | string;
let startLine: undefined | Number1;
let endLine: undefined | Number1;
- let suppressionType: undefined | DiagnosticSuppressionType;
if (line.startsWith(SUPPRESSION_CURRENT_LINE_START)) {
matchedPrefix = SUPPRESSION_CURRENT_LINE_START;
startLine = commentLocation.start.line;
endLine = startLine;
- suppressionType = 'current';
- }
- if (line.startsWith(SUPPRESSION_NEXT_LINE_START)) {
+ } else if (line.startsWith(SUPPRESSION_NEXT_LINE_START)) {
matchedPrefix = SUPPRESSION_NEXT_LINE_START;
startLine = ob1Inc(commentLocation.start.line);
endLine = startLine;
- suppressionType = 'next';
- }
- if (line.startsWith(SUPPRESSION_NEXT_STATEMENT_START)) {
- matchedPrefix = SUPPRESSION_NEXT_STATEMENT_START;
+ } else if (line.startsWith(SUPPRESSION_NEXT_NODE_START)) {
+ matchedPrefix = SUPPRESSION_NEXT_NODE_START;
const nodeToComment = getNodeToComment();
const nextNode = nodeToComment.get(comment);
@@ -139,7 +133,6 @@ function extractSuppressionsFromComment(
});
continue;
} else {
- suppressionType = 'statement';
startLine = nextNode.loc.start.line;
endLine = nextNode.loc.end.line;
}
@@ -148,8 +141,7 @@ function extractSuppressionsFromComment(
if (
matchedPrefix === undefined ||
endLine === undefined ||
- startLine === undefined ||
- suppressionType === undefined
+ startLine === undefined
) {
const mistake = detectPossibleMistake(line);
if (mistake !== undefined) {
@@ -197,7 +189,6 @@ function extractSuppressionsFromComment(
suppressedCategories.add(category);
suppressions.push({
- type: suppressionType,
filename: context.filename,
category,
commentLocation,

Rename rome-ignore-next-statement to rome-ignore-next