Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 0102ce8

Browse files
committed
Provide support for repo vite
1 parent 518623a commit 0102ce8

21 files changed

+847
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Next
22

3-
[diff](https://github.com/Shinigami92/eslint-define-config/compare/1.0.7...main)
3+
[diff](https://github.com/Shinigami92/eslint-define-config/compare/1.0.8...main)
4+
5+
# 1.0.8
6+
7+
[diff](https://github.com/Shinigami92/eslint-define-config/compare/1.0.7...1.0.8)
8+
9+
- Provide support for repo [Vite](https://github.com/vitejs/vite)
410

511
# 1.0.7
612

scripts/generate-rule.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ function generateRuleFileContent(name, provider) {
5151
case 'import':
5252
RuleLink = `https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/${kebabCase}.md`;
5353
break;
54+
case 'node':
55+
RuleLink = `https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/${kebabCase}.md`;
56+
break;
5457
}
5558

5659
provider = provider === 'eslint' ? '' : `${provider}/`;

src/extends/eslint-plugin-node.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Eslint Node extensions.
3+
*
4+
* @see [Eslint Node extensions](https://github.com/mysticatea/eslint-plugin-node#-configs)
5+
*/
6+
export type NodeExtensions =
7+
| 'plugin:node/recommended'
8+
| 'plugin:node/recommended-module'
9+
| 'plugin:node/recommended-script';

src/extends/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { LiteralUnion } from '../utility-types';
22
import type { EslintExtensions } from './eslint';
33
import type { ImportExtensions } from './eslint-plugin-import';
44
import type { JsdocExtensions } from './eslint-plugin-jsdoc';
5+
import type { NodeExtensions } from './eslint-plugin-node';
56
import type { PrettierExtensions } from './eslint-plugin-prettier';
67
import type { VueExtensions } from './eslint-plugin-vue';
78
import type { TypescriptEslintExtensions } from './typescript-eslint';
@@ -13,6 +14,7 @@ export type KnownExtensions = LiteralUnion<
1314
| EslintExtensions
1415
| TypescriptEslintExtensions
1516
| PrettierExtensions
17+
| NodeExtensions
1618
| ImportExtensions
1719
| JsdocExtensions
1820
| VueExtensions

src/rules/eslint/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ import type { NoCaseDeclarationsRule } from './no-case-declarations';
1212
import type { NoConstantConditionRule } from './no-constant-condition';
1313
import type { NoDebuggerRule } from './no-debugger';
1414
import type { NoEmptyFunctionRule } from './no-empty-function';
15+
import type { NoProcessExitRule } from './no-process-exit';
1516
import type { NoUnusedExpressionsRule } from './no-unused-expressions';
1617
import type { NoUselessConcatRule } from './no-useless-concat';
18+
import type { PreferConstRule } from './prefer-const';
1719
import type { PreferTemplateRule } from './prefer-template';
1820
import type { QuotePropsRule } from './quote-props';
1921
import type { QuotesRule } from './quotes';
@@ -36,8 +38,10 @@ export type EslintRules = CommaDangleRule &
3638
NoConstantConditionRule &
3739
NoDebuggerRule &
3840
NoEmptyFunctionRule &
41+
NoProcessExitRule &
3942
NoUnusedExpressionsRule &
4043
NoUselessConcatRule &
44+
PreferConstRule &
4145
PreferTemplateRule &
4246
QuotePropsRule &
4347
QuotesRule &

src/rules/eslint/no-process-exit.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Disallow `process.exit()`.
5+
*
6+
* @see [no-process-exit](https://eslint.org/docs/rules/no-process-exit)
7+
*
8+
* @deprecated This rule was **deprecated** in ESLint `v7.0.0`. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
9+
*/
10+
export type NoProcessExitRuleConfig = RuleConfig<[]>;
11+
12+
/**
13+
* Disallow `process.exit()`.
14+
*
15+
* @see [no-process-exit](https://eslint.org/docs/rules/no-process-exit)
16+
*
17+
* @deprecated This rule was **deprecated** in ESLint `v7.0.0`. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
18+
*/
19+
export interface NoProcessExitRule {
20+
/**
21+
* Disallow `process.exit()`.
22+
*
23+
* @see [no-process-exit](https://eslint.org/docs/rules/no-process-exit)
24+
*
25+
* @deprecated This rule was **deprecated** in ESLint `v7.0.0`. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
26+
*/
27+
'no-process-exit'?: NoProcessExitRuleConfig;
28+
}

src/rules/eslint/prefer-const.d.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Option.
5+
*/
6+
export type PreferConstOption = {
7+
/**
8+
* The kind of the way to address variables in destructuring.
9+
*
10+
* @default 'any'
11+
*
12+
* @see [destructuring](https://eslint.org/docs/rules/prefer-const#destructuring)
13+
*/
14+
destructuring?: 'any' | 'all';
15+
/**
16+
* This is an option to avoid conflicting with `no-use-before-define` rule (without `"nofunc"` option).
17+
*
18+
* If `true` is specified, this rule will ignore variables that are read between the declaration and the first assignment.
19+
*
20+
* @default false
21+
*
22+
* @see [ignoreReadBeforeAssign](https://eslint.org/docs/rules/prefer-const#ignorereadbeforeassign)
23+
*/
24+
ignoreReadBeforeAssign?: boolean;
25+
};
26+
27+
/**
28+
* Options.
29+
*/
30+
export type PreferConstOptions = [PreferConstOption?];
31+
32+
/**
33+
* Suggest using `const`.
34+
*
35+
* @see [prefer-const](https://eslint.org/docs/rules/prefer-const)
36+
*/
37+
export type PreferConstRuleConfig = RuleConfig<PreferConstOptions>;
38+
39+
/**
40+
* Suggest using `const`.
41+
*
42+
* @see [prefer-const](https://eslint.org/docs/rules/prefer-const)
43+
*/
44+
export interface PreferConstRule {
45+
/**
46+
* Suggest using `const`.
47+
*
48+
* @see [prefer-const](https://eslint.org/docs/rules/prefer-const)
49+
*/
50+
'prefer-const': PreferConstRuleConfig;
51+
}

src/rules/index.d.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { EslintRules } from './eslint';
22
import type { ImportRules } from './import';
33
import type { JSDocRules } from './jsdoc';
4+
import type { NodeRules } from './node';
45
import type { RuleConfig } from './rule-config';
56
import type { SpellcheckRules } from './spellcheck';
67
import type { TypeScriptEslintRules } from './typescript-eslint';
@@ -11,5 +12,11 @@ import type { TypeScriptEslintRules } from './typescript-eslint';
1112
* @see [Rules](https://eslint.org/docs/user-guide/configuring/rules)
1213
*/
1314
export type Rules = Partial<
14-
EslintRules & TypeScriptEslintRules & ImportRules & JSDocRules & SpellcheckRules & Record<string, RuleConfig>
15+
EslintRules &
16+
TypeScriptEslintRules &
17+
NodeRules &
18+
ImportRules &
19+
JSDocRules &
20+
SpellcheckRules &
21+
Record<string, RuleConfig>
1522
>;

src/rules/node/index.d.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { NoDeprecatedApiRule } from './no-deprecated-api';
2+
import type { NoExtraneousImportRule } from './no-extraneous-import';
3+
import type { NoExtraneousRequireRule } from './no-extraneous-require';
4+
import type { NoMissingImportRule } from './no-missing-import';
5+
import type { NoMissingRequireRule } from './no-missing-require';
6+
import type { NoProcessExitRuleConfig } from './no-process-exit';
7+
import type { NoRestrictedRequireRule } from './no-restricted-require';
8+
import type { NoUnpublishedImportRule } from './no-unpublished-import';
9+
import type { NoUnpublishedRequireRule } from './no-unpublished-require';
10+
import type { NoUnsupportedFeaturesEsSyntaxRule } from './no-unsupported-features/es-syntax';
11+
12+
/**
13+
* All node rules.
14+
*/
15+
export type NodeRules = NoDeprecatedApiRule &
16+
NoExtraneousImportRule &
17+
NoExtraneousRequireRule &
18+
NoMissingImportRule &
19+
NoMissingRequireRule &
20+
NoProcessExitRuleConfig &
21+
NoRestrictedRequireRule &
22+
NoUnpublishedImportRule &
23+
NoUnpublishedRequireRule &
24+
NoUnsupportedFeaturesEsSyntaxRule;

src/rules/node/no-deprecated-api.d.ts

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
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

Comments
 (0)