mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
2eff28fb7a
Greatly simplify how ESLint and its plugins are installed. PR-URL: https://github.com/nodejs/node/pull/53413 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
if (!common.hasIntl)
|
|
common.skip('missing Intl');
|
|
common.skipIfEslintMissing();
|
|
|
|
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
|
|
const rule = require('../../tools/eslint-rules/documented-deprecation-codes');
|
|
|
|
const mdFile = 'doc/api/deprecations.md';
|
|
|
|
const invalidCode = 'UNDOCUMENTED INVALID CODE';
|
|
|
|
new RuleTester().run('documented-deprecation-codes', rule, {
|
|
valid: [
|
|
`
|
|
deprecate(function() {
|
|
return this.getHeaders();
|
|
}, 'OutgoingMessage.prototype._headers is deprecated', 'DEP0066')
|
|
`,
|
|
],
|
|
invalid: [
|
|
{
|
|
code: `
|
|
deprecate(function foo(){}, 'bar', '${invalidCode}');
|
|
`,
|
|
errors: [
|
|
{
|
|
message: `"${invalidCode}" does not match the expected pattern`,
|
|
line: 2
|
|
},
|
|
{
|
|
message: `"${invalidCode}" is not documented in ${mdFile}`,
|
|
line: 2
|
|
},
|
|
]
|
|
},
|
|
]
|
|
});
|