|
| 1 | +import { LiteralUnion } from '../../utility-types'; |
| 2 | +import type { RuleConfig } from '../rule-config'; |
| 3 | + |
| 4 | +/** NoDeprecatedApiModuleItem. */ |
| 5 | +export type NoDeprecatedApiModuleItem = |
| 6 | + /* eslint-disable spellcheck/spell-checker */ |
| 7 | + | '_linklist' |
| 8 | + | '_stream_wrap' |
| 9 | + | 'async_hooks.currentId' |
| 10 | + | 'async_hooks.triggerId' |
| 11 | + | 'buffer.Buffer()' |
| 12 | + | 'new buffer.Buffer()' |
| 13 | + | 'buffer.SlowBuffer' |
| 14 | + | 'constants' |
| 15 | + | 'crypto._toBuf' |
| 16 | + | 'crypto.Credentials' |
| 17 | + | 'crypto.DEFAULT_ENCODING' |
| 18 | + | 'crypto.createCipher' |
| 19 | + | 'crypto.createCredentials' |
| 20 | + | 'crypto.createDecipher' |
| 21 | + | 'crypto.fips' |
| 22 | + | 'crypto.prng' |
| 23 | + | 'crypto.pseudoRandomBytes' |
| 24 | + | 'crypto.rng' |
| 25 | + | 'domain' |
| 26 | + | 'events.EventEmitter.listenerCount' |
| 27 | + | 'events.listenerCount' |
| 28 | + | 'freelist' |
| 29 | + | 'fs.SyncWriteStream' |
| 30 | + | 'fs.exists' |
| 31 | + | 'fs.lchmod' |
| 32 | + | 'fs.lchmodSync' |
| 33 | + | 'http.createClient' |
| 34 | + | 'module.Module.createRequireFromPath' |
| 35 | + | 'module.createRequireFromPath' |
| 36 | + | 'module.Module.requireRepl' |
| 37 | + | 'module.requireRepl' |
| 38 | + | 'module.Module._debug' |
| 39 | + | 'module._debug' |
| 40 | + | 'net._setSimultaneousAccepts' |
| 41 | + | 'os.tmpDir' |
| 42 | + | 'path._makeLong' |
| 43 | + | 'process.EventEmitter' |
| 44 | + | 'process.assert' |
| 45 | + | 'process.binding' |
| 46 | + | 'process.env.NODE_REPL_HISTORY_FILE' |
| 47 | + | 'process.report.triggerReport' |
| 48 | + | 'punycode' |
| 49 | + | 'readline.codePointAt' |
| 50 | + | 'readline.getStringWidth' |
| 51 | + | 'readline.isFullWidthCodePoint' |
| 52 | + | 'readline.stripVTControlCharacters' |
| 53 | + | 'sys' |
| 54 | + | 'timers.enroll' |
| 55 | + | 'timers.unenroll' |
| 56 | + | 'tls.CleartextStream' |
| 57 | + | 'tls.CryptoStream' |
| 58 | + | 'tls.SecurePair' |
| 59 | + | 'tls.convertNPNProtocols' |
| 60 | + | 'tls.createSecurePair' |
| 61 | + | 'tls.parseCertString' |
| 62 | + | 'tty.setRawMode' |
| 63 | + | 'url.parse' |
| 64 | + | 'url.resolve' |
| 65 | + | 'util.debug' |
| 66 | + | 'util.error' |
| 67 | + | 'util.isArray' |
| 68 | + | 'util.isBoolean' |
| 69 | + | 'util.isBuffer' |
| 70 | + | 'util.isDate' |
| 71 | + | 'util.isError' |
| 72 | + | 'util.isFunction' |
| 73 | + | 'util.isNull' |
| 74 | + | 'util.isNullOrUndefined' |
| 75 | + | 'util.isNumber' |
| 76 | + | 'util.isObject' |
| 77 | + | 'util.isPrimitive' |
| 78 | + | 'util.isRegExp' |
| 79 | + | 'util.isString' |
| 80 | + | 'util.isSymbol' |
| 81 | + | 'util.isUndefined' |
| 82 | + | 'util.log' |
| 83 | + | 'util.print' |
| 84 | + | 'util.pump' |
| 85 | + | 'util.puts' |
| 86 | + | 'util._extend' |
| 87 | + | 'vm.runInDebugContext'; |
| 88 | +/* eslint-enable spellcheck/spell-checker */ |
| 89 | + |
| 90 | +/** NoDeprecatedApiGlobalItem. */ |
| 91 | +export type NoDeprecatedApiGlobalItem = |
| 92 | + | 'Buffer()' |
| 93 | + | 'new Buffer()' |
| 94 | + | 'COUNTER_NET_SERVER_CONNECTION' |
| 95 | + | 'COUNTER_NET_SERVER_CONNECTION_CLOSE' |
| 96 | + | 'COUNTER_HTTP_SERVER_REQUEST' |
| 97 | + | 'COUNTER_HTTP_SERVER_RESPONSE' |
| 98 | + | 'COUNTER_HTTP_CLIENT_REQUEST' |
| 99 | + | 'COUNTER_HTTP_CLIENT_RESPONSE' |
| 100 | + | 'Intl.v8BreakIterator' |
| 101 | + | 'require.extensions' |
| 102 | + | 'process.EventEmitter' |
| 103 | + | 'process.assert' |
| 104 | + | 'process.binding' |
| 105 | + | 'process.env.NODE_REPL_HISTORY_FILE'; |
| 106 | + |
| 107 | +/** |
| 108 | + * Option. |
| 109 | + */ |
| 110 | +export type NoDeprecatedApiOption = { |
| 111 | + /** |
| 112 | + * As mentioned above, this rule reads the [engines] field of `package.json`. But, you can overwrite the version by `version` option. |
| 113 | + * |
| 114 | + * The `version` option accepts [the valid version range of `node-semver`](https://github.com/npm/node-semver#range-grammar). |
| 115 | + * |
| 116 | + * @see [version](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md#version) |
| 117 | + */ |
| 118 | + version?: string; |
| 119 | + /** |
| 120 | + * This is the array of module names and module's member names. |
| 121 | + * |
| 122 | + * @default [] |
| 123 | + * |
| 124 | + * @see [ignoreModuleItems](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md#ignoremoduleitems) |
| 125 | + */ |
| 126 | + ignoreModuleItems?: Array<LiteralUnion<NoDeprecatedApiModuleItem>>; |
| 127 | + /** |
| 128 | + * This is the array of global variable names and global variable's member names. |
| 129 | + * |
| 130 | + * @default [] |
| 131 | + * |
| 132 | + * @see [ignoreGlobalItems](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md#ignoreglobalitems) |
| 133 | + */ |
| 134 | + ignoreGlobalItems?: Array<LiteralUnion<NoDeprecatedApiGlobalItem>>; |
| 135 | +}; |
| 136 | + |
| 137 | +/** |
| 138 | + * Options. |
| 139 | + */ |
| 140 | +export type NoDeprecatedApiOptions = [NoDeprecatedApiOption?]; |
| 141 | + |
| 142 | +/** |
| 143 | + * Node has many deprecated API. The community is going to remove those API from Node in future, so we should not use those. |
| 144 | + * |
| 145 | + * @see [no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) |
| 146 | + */ |
| 147 | +export type NoDeprecatedApiRuleConfig = RuleConfig<NoDeprecatedApiOptions>; |
| 148 | + |
| 149 | +/** |
| 150 | + * Node has many deprecated API. The community is going to remove those API from Node in future, so we should not use those. |
| 151 | + * |
| 152 | + * @see [no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) |
| 153 | + */ |
| 154 | +export interface NoDeprecatedApiRule { |
| 155 | + /** |
| 156 | + * Node has many deprecated API. The community is going to remove those API from Node in future, so we should not use those. |
| 157 | + * |
| 158 | + * @see [no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) |
| 159 | + */ |
| 160 | + 'node/no-deprecated-api': NoDeprecatedApiRuleConfig; |
| 161 | +} |
0 commit comments