chrome-devtools-frontend
Version:
Chrome DevTools UI
28 lines (24 loc) • 729 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.
;
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'enforce usage of readonly rather than the ReadonlyArray helper',
category: 'Possible Errors',
},
fixable: 'code',
schema: [] // no options
},
create: function(context) {
return {
TSTypeReference(node) {
if (node.typeName.type === 'Identifier' && node.typeName.name === 'ReadonlyArray') {
context.report({node, message: 'Prefer the readonly keyword over the ReadonlyArray type.'});
}
},
};
}
};