mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 01:38:07 +08:00
R=andoli@chromium.org Bug: 1130536 Change-Id: I2304b32f1f0c9f4a6713156c9218ec9d0c9270ae Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2562854 Commit-Queue: Jack Franklin <jacktfranklin@chromium.org> Auto-Submit: Jack Franklin <jacktfranklin@chromium.org> Reviewed-by: Andres Olivares <andoli@chromium.org>
28 lines
697 B
JavaScript
28 lines
697 B
JavaScript
// Copyright 2020 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
'use strict';
|
|
|
|
module.exports = {
|
|
meta: {
|
|
type: 'problem',
|
|
docs: {
|
|
description: 'enforce const enum in TypeScript',
|
|
category: 'Possible Errors',
|
|
},
|
|
fixable: 'code',
|
|
schema: [] // no options
|
|
},
|
|
create: function(context) {
|
|
return {
|
|
TSEnumDeclaration(node) {
|
|
const isConstEnum = node.const === true;
|
|
|
|
if (!isConstEnum) {
|
|
context.report({node, message: 'TypeScript enums must be declared as const enums: const enum Foo {...}'});
|
|
}
|
|
}
|
|
};
|
|
}
|
|
};
|