implement noExplicitAny
MODIFY
packages/@romejs/diagnostics/categories.ts
packages/@romejs/diagnostics/categories.ts
@@ -36,6 +36,7 @@ export type DiagnosticCategory =
| 'lint/noDuplicateCase'
| 'lint/noDuplicateKeys'
| 'lint/noEmptyCharacterClass'
+ | 'lint/noExplicitAny'
| 'lint/noExtraBooleanCast'
| 'lint/noFunctionAssign'
| 'lint/noImportAssign'

MODIFY
packages/@romejs/js-compiler/transforms/lint/index.ts
packages/@romejs/js-compiler/transforms/lint/index.ts
@@ -20,6 +20,7 @@ import noDupeArgs from './noDupeArgs';
import noDuplicateCase from './noDuplicateCase';
import noDuplicateKeys from './noDuplicateKeys';
import noEmptyCharacterClass from './noEmptyCharacterClass';
+import noExplicitAny from './noExplicitAny';
import noExtraBooleanCast from './noExtraBooleanCast';
import noFunctionAssign from './noFunctionAssign';
import noImportAssign from './noImportAssign';
@@ -50,6 +51,7 @@ export const lintTransforms = [
noDuplicateCase,
noDuplicateKeys,
noEmptyCharacterClass,
+ noExplicitAny,
noExtraBooleanCast,
noFunctionAssign,
noImportAssign,

ADD
packages/@romejs/js-compiler/transforms/lint/noExplicitAny.ts
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+import {AnyNode} from '@romejs/js-ast';
+import {Path} from '@romejs/js-compiler';
+
+export default {
+ name: 'noExplicitAny',
+ enter(path: Path): AnyNode {
+ const {context, node} = path;
+
+ if (node.type === 'AnyKeywordTypeAnnotation') {
+ context.addNodeDiagnostic(node, {
+ category: 'lint/noExplicitAny',
+ message: 'Unexpected any. Specify a different type.',
+ });
+ }
+
+ return node;
+ },
+};

implement noExplicitAny