Skip to content

Commit 3e88941

Browse files
committed
Add back missing rules
1 parent 359cc84 commit 3e88941

104 files changed

Lines changed: 608 additions & 337 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

common/views.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import { RemoteInfo } from './types';
67
import { ClosedEvent, CommentEvent } from '../src/common/timelineEvent';
78
import { GithubItemStateEnum, IAccount, ILabel, IMilestone, IProject, ITeam, MergeMethod, MergeMethodsAvailability } from '../src/github/interface';
89
import { DisplayLabel, PreReviewState } from '../src/github/views';
9-
import { RemoteInfo } from './types';
1010

1111
export interface CreateParams {
1212
availableBaseRemotes: RemoteInfo[];

eslint.config.mjs

Lines changed: 68 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ export default defineConfig([
1818
'dist/**/*',
1919
'out/**/*',
2020
'src/@types/**/*.d.ts',
21-
'src/api/api.d.ts',
21+
'src/api/api*.d.ts',
2222
'src/test/**',
2323
'**/*.{js,mjs,cjs}',
24+
'.vscode-test/**/*'
2425
]
2526
},
2627

@@ -40,6 +41,24 @@ export default defineConfig([
4041
'rulesdir': /** @type {any} */(rulesdir),
4142
'@typescript-eslint': tseslint.plugin,
4243
},
44+
settings: {
45+
// Let plugin-import resolve TS paths (including d.ts, type packages, etc.)
46+
'import/resolver': {
47+
typescript: {
48+
project: [
49+
'tsconfig.base.json',
50+
'tsconfig.json',
51+
'tsconfig.webviews.json'
52+
],
53+
alwaysTryTypes: true
54+
},
55+
node: {
56+
extensions: ['.js', '.mjs', '.cjs', '.ts', '.tsx', '.d.ts']
57+
}
58+
},
59+
// For rules like import/extensions (list everything you consider "module" extensions)
60+
'import/extensions': ['.js', '.mjs', '.cjs', '.ts', '.tsx']
61+
},
4362
rules: {
4463
// ESLint recommended rules
4564
...js.configs.recommended.rules,
@@ -50,17 +69,17 @@ export default defineConfig([
5069
'no-console': 'off',
5170
'no-constant-condition': ['warn', { 'checkLoops': false }],
5271
'no-caller': 'error',
53-
'no-case-declarations': 'off',
72+
'no-case-declarations': 'off', // TODO@alexr00 revisit
5473
'no-debugger': 'warn',
5574
'no-dupe-class-members': 'off',
5675
'no-duplicate-imports': 'error',
57-
'no-else-return': 'off',
58-
'no-empty': 'off',
76+
'no-else-return': 'off', // TODO@alexr00 revisit
77+
'no-empty': 'off', // TODO@alexr00 revisit
5978
'no-eval': 'error',
6079
'no-ex-assign': 'warn',
6180
'no-extend-native': 'error',
6281
'no-extra-bind': 'error',
63-
'no-extra-boolean-cast': 'off',
82+
'no-extra-boolean-cast': 'off', // TODO@alexr00 revisit
6483
'no-floating-decimal': 'error',
6584
'no-implicit-coercion': 'off',
6685
'no-implied-eval': 'error',
@@ -71,7 +90,7 @@ export default defineConfig([
7190
'no-multi-spaces': 'off',
7291
'no-prototype-builtins': 'off',
7392
'no-return-assign': 'error',
74-
'no-return-await': 'off',
93+
'no-return-await': 'off', // TODO@alexr00 revisit
7594
'no-self-compare': 'error',
7695
'no-sequences': 'error',
7796
'no-template-curly-in-string': 'warn',
@@ -97,14 +116,14 @@ export default defineConfig([
97116
],
98117
'no-unused-vars': "off", // Disable the base rule so we can use the TS version
99118
'object-shorthand': 'off',
100-
'one-var': 'off',
101-
'prefer-arrow-callback': 'off',
119+
'one-var': 'off', // TODO@alexr00 revisit
120+
'prefer-arrow-callback': 'off', // TODO@alexr00 revisit
102121
'prefer-const': 'off',
103122
'prefer-numeric-literals': 'error',
104123
'prefer-object-spread': 'error',
105124
'prefer-rest-params': 'error',
106125
'prefer-spread': 'error',
107-
'prefer-template': 'off',
126+
'prefer-template': 'off', // TODO@alexr00 revisit
108127
'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }],
109128
'require-atomic-updates': 'off',
110129
'semi': ['error', 'always'],
@@ -122,19 +141,38 @@ export default defineConfig([
122141

123142
// Import plugin rules
124143
'import/export': 'off',
125-
'import/extensions': ['error', 'never'],
144+
'import/extensions': ['error', 'ignorePackages', {
145+
js: 'never',
146+
mjs: 'never',
147+
cjs: 'never',
148+
ts: 'never',
149+
tsx: 'never'
150+
}],
126151
'import/named': 'off',
127152
'import/namespace': 'off',
128153
'import/newline-after-import': 'warn',
129154
'import/no-cycle': 'off',
130155
'import/no-dynamic-require': 'error',
131-
'import/no-default-export': 'off',
156+
'import/no-default-export': 'off', // TODO@alexr00 revisit
132157
'import/no-duplicates': 'error',
133158
'import/no-self-import': 'error',
159+
'import/no-unresolved': ['warn', { 'ignore': ['vscode', 'ghpr', 'git', 'extensionApi', '@octokit/rest', '@octokit/types'] }],
160+
'import/order': [
161+
'warn',
162+
{
163+
'groups': ['builtin', 'external', 'internal', ['parent', 'sibling', 'index']],
164+
'newlines-between': 'ignore',
165+
'alphabetize': {
166+
'order': 'asc',
167+
'caseInsensitive': true
168+
}
169+
}
170+
],
134171

135172
// TypeScript ESLint rules
136173
'@typescript-eslint/await-thenable': 'error',
137-
'@typescript-eslint/ban-types': 'off',
174+
'@typescript-eslint/ban-types': 'off', // TODO@alexr00 revisit
175+
138176
'@typescript-eslint/consistent-type-assertions': [
139177
'warn',
140178
{
@@ -144,35 +182,37 @@ export default defineConfig([
144182
],
145183
'@typescript-eslint/explicit-function-return-type': 'off',
146184
'@typescript-eslint/explicit-member-accessibility': 'off',
147-
'@typescript-eslint/explicit-module-boundary-types': 'off',
185+
'@typescript-eslint/explicit-module-boundary-types': 'off', // TODO@alexr00 revisit
186+
148187
'@typescript-eslint/no-empty-function': 'off',
149188
'@typescript-eslint/no-empty-interface': 'error',
150189
'@typescript-eslint/no-explicit-any': 'off',
151-
'@typescript-eslint/no-floating-promises': 'off',
190+
'@typescript-eslint/no-floating-promises': 'off', // TODO@alexr00 revisit
152191
'@typescript-eslint/no-implied-eval': 'error',
153-
'@typescript-eslint/no-inferrable-types': 'off',
192+
'@typescript-eslint/no-inferrable-types': 'off', // TODO@alexr00 revisit
154193
'@typescript-eslint/no-misused-promises': ['error', { 'checksConditionals': false, 'checksVoidReturn': false }],
155194
'@typescript-eslint/no-namespace': 'off',
156195
'@typescript-eslint/no-non-null-assertion': 'off',
196+
"@typescript-eslint/no-redeclare": ["error", { "ignoreDeclarationMerge": true }],
157197
'@typescript-eslint/no-redundant-type-constituents': 'off',
158198
'@typescript-eslint/no-this-alias': 'off',
159199
'@typescript-eslint/no-unnecessary-condition': 'off',
160-
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
200+
'@typescript-eslint/no-unnecessary-type-assertion': 'off', // TODO@alexr00 revisit
161201
'@typescript-eslint/no-unsafe-argument': 'off',
162-
'@typescript-eslint/no-unsafe-assignment': 'off',
163-
'@typescript-eslint/no-unsafe-call': 'off',
202+
'@typescript-eslint/no-unsafe-assignment': 'off', // TODO@alexr00 revisit
203+
'@typescript-eslint/no-unsafe-call': 'off', // TODO@alexr00 revisit
164204
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
165-
'@typescript-eslint/no-unsafe-member-access': 'off',
166-
'@typescript-eslint/no-unsafe-return': 'off',
205+
'@typescript-eslint/no-unsafe-member-access': 'off', // TODO@alexr00 revisit
206+
'@typescript-eslint/no-unsafe-return': 'off', // TODO@alexr00 revisit
167207
'@typescript-eslint/no-unused-expressions': ['warn', { 'allowShortCircuit': true }],
168208
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_', caughtErrors: 'none' }],
169209
'@typescript-eslint/no-use-before-define': 'off',
170-
'@typescript-eslint/prefer-regexp-exec': 'off',
210+
'@typescript-eslint/prefer-regexp-exec': 'off', // TODO@alexr00 revisit
171211
'@typescript-eslint/prefer-nullish-coalescing': 'off',
172212
'@typescript-eslint/prefer-optional-chain': 'off',
173-
'@typescript-eslint/require-await': 'off',
213+
'@typescript-eslint/require-await': 'off', // TODO@alexr00 revisit
174214
'@typescript-eslint/restrict-plus-operands': 'error',
175-
'@typescript-eslint/restrict-template-expressions': 'off',
215+
'@typescript-eslint/restrict-template-expressions': 'off', // TODO@alexr00 revisit
176216
'@typescript-eslint/strict-boolean-expressions': 'off',
177217
'@typescript-eslint/unbound-method': 'off',
178218

@@ -216,10 +256,7 @@ export default defineConfig([
216256
...globals.browser,
217257
'Thenable': true,
218258
},
219-
},
220-
rules: {
221-
'rulesdir/public-methods-well-defined-types': 'error'
222-
},
259+
}
223260
},
224261

225262
// Webviews
@@ -236,6 +273,9 @@ export default defineConfig([
236273
...globals.browser,
237274
'JSX': true,
238275
},
239-
}
276+
},
277+
rules: {
278+
'rulesdir/public-methods-well-defined-types': 'error'
279+
},
240280
},
241281
]);

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4237,6 +4237,7 @@
42374237
"css-loader": "7.1.2",
42384238
"esbuild-loader": "4.2.2",
42394239
"eslint": "^9.36.0",
4240+
"eslint-import-resolver-typescript": "^4.4.4",
42404241
"eslint-plugin-import": "2.31.0",
42414242
"eslint-plugin-rulesdir": "^0.2.2",
42424243
"event-stream": "^4.0.1",
@@ -4312,4 +4313,4 @@
43124313
"string_decoder": "^1.3.0"
43134314
},
43144315
"license": "MIT"
4315-
}
4316+
}

src/api/api1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as vscode from 'vscode';
7+
import { API, IGit, PostCommitCommandsProvider, Repository, ReviewerCommentsProvider, TitleAndDescriptionProvider } from './api';
78
import { APIState, PublishEvent } from '../@types/git';
89
import { Disposable } from '../common/lifecycle';
910
import Logger from '../common/logger';
1011
import { TernarySearchTree } from '../common/utils';
1112
import { RepositoriesManager } from '../github/repositoriesManager';
12-
import { API, IGit, PostCommitCommandsProvider, Repository, ReviewerCommentsProvider, TitleAndDescriptionProvider } from './api';
1313

1414
export const enum RefType {
1515
Head,

src/authentication/githubServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
import fetch from 'cross-fetch';
77
import * as vscode from 'vscode';
8+
import { HostHelper } from './configuration';
89
import { GitHubServerType } from '../common/authentication';
910
import Logger from '../common/logger';
1011
import { agent } from '../env/node/net';
1112
import { getEnterpriseUri } from '../github/utils';
12-
import { HostHelper } from './configuration';
1313

1414
export class GitHubManager {
1515
private static readonly _githubDotComServers = new Set<string>().add('github.com').add('ssh.github.com');

src/common/comment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as vscode from 'vscode';
7-
import { IAccount, Reaction } from '../github/interface';
87
import { COPILOT_LOGINS } from './copilot';
98
import { DiffHunk } from './diffHunk';
9+
import { IAccount, Reaction } from '../github/interface';
1010

1111
export enum DiffSide {
1212
LEFT = 'LEFT',

src/common/diffHunk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* Inspired by and includes code from GitHub/VisualStudio project, obtained from https://github.com/github/VisualStudio/blob/master/src/GitHub.Exports/Models/DiffLine.cs
88
*/
99

10-
import { IRawFileChange } from '../github/interface';
1110
import { GitChangeType, InMemFileChange, SlimFileChange } from './file';
11+
import { IRawFileChange } from '../github/interface';
1212

1313
export enum DiffChangeType {
1414
Context,

src/common/githubRef.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { Remote, Repository } from '../api/api';
76
import { Protocol } from './protocol';
87
import { parseRemote } from './remote';
8+
import { Remote, Repository } from '../api/api';
99

1010
export class GitHubRef {
1111
public repositoryCloneUrl: Protocol;

src/common/protocol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as vscode from 'vscode';
7-
import { resolve } from '../env/node/ssh';
87
import Logger from './logger';
8+
import { resolve } from '../env/node/ssh';
99

1010

1111
export enum ProtocolType {

src/common/remote.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { Repository } from '../api/api';
7-
import { getEnterpriseUri, isEnterprise } from '../github/utils';
86
import { AuthProvider, GitHubServerType } from './authentication';
97
import { Protocol } from './protocol';
8+
import { Repository } from '../api/api';
9+
import { getEnterpriseUri, isEnterprise } from '../github/utils';
1010

1111
export class Remote {
1212
public get host(): string {

0 commit comments

Comments
 (0)