Skip to content

Commit 76eafc5

Browse files
authored
[engsys] upgrade dev dependency eslint-plugin-markdown to ^5.0.0 (Azure#29697)
The breaking change that impacts us is that now `typescript` and `javascript` code blocks in markdown files are maped to virtual files with `.ts` or `.js`, instead of `.typescript` or `.javascript` as previously in v4. This PR reacts to the change: - Add an overrides entry for `**/*.md/*.ts` because they now match the files pattern of our first overrides entry. Previously they are not linted because of their old `.typescript` extension. Their `project` is set to `null` as they don't belong to any project. They still are benefited from rules that don't require type checking.
1 parent 3d032ef commit 76eafc5

File tree

9 files changed

+456
-434
lines changed

9 files changed

+456
-434
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 416 additions & 416 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/tools/eslint-plugin-azure-sdk-helper/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"eslint-plugin-no-only-tests": "^3.0.0",
1313
"eslint-plugin-promise": "^6.0.0",
1414
"eslint-plugin-tsdoc": "^0.2.10",
15-
"eslint-plugin-markdown": "^4.0.0"
15+
"eslint-plugin-markdown": "^5.0.0"
1616
},
1717
"dependencies": {
1818
"@typescript-eslint/utils": "~7.8.0",

common/tools/eslint-plugin-azure-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"@vitest/coverage-istanbul": "^1.4.0",
8181
"cross-env": "^7.0.3",
8282
"eslint": "^8.50.0",
83-
"eslint-plugin-markdown": "^4.0.0",
83+
"eslint-plugin-markdown": "^5.0.0",
8484
"prettier": "^3.2.5",
8585
"rimraf": "^5.0.5",
8686
"source-map-support": "^0.5.9",

common/tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,29 @@ export default {
1515
"import",
1616
"markdown",
1717
],
18-
extends: ["eslint:recommended", "plugin:promise/recommended", "prettier"],
1918
env: {
2019
mocha: true,
20+
es2017: true,
2121
},
2222
ignorePatterns: ["**/generated/**"],
2323
overrides: [
2424
{
2525
files: ["*.ts", "*.cts", "*.mts", "*.tsx", "*.json"],
26+
excludedFiles: [
27+
"**/*.md/*.ts",
28+
"**/*.md/*.json",
29+
"**/src/**/*.json",
30+
"**/test/**/*.json",
31+
],
2632
parserOptions: {
2733
project: [
2834
"./tsconfig.json",
2935
"../../../common/tools/eslint-plugin-azure-sdk/tsconfig.lintjson.json",
3036
],
3137
},
3238
extends: [
39+
"eslint:recommended",
40+
"plugin:promise/recommended",
3341
"plugin:@typescript-eslint/recommended",
3442
"plugin:@typescript-eslint/eslint-recommended",
3543
"prettier",
@@ -140,9 +148,11 @@ export default {
140148
processor: "markdown/markdown",
141149
},
142150
{
143-
files: ["**/*.md/*.{js,javascript}"],
151+
files: ["*.md/*.js"],
144152
extends: ["plugin:markdown/recommended-legacy"],
145153
rules: {
154+
"no-unused-vars": "off",
155+
"no-undef": "off",
146156
"no-restricted-imports": [
147157
"error",
148158
{
@@ -156,5 +166,15 @@ export default {
156166
],
157167
},
158168
},
169+
{
170+
files: ["*md/*.ts"],
171+
parserOptions: {
172+
project: null,
173+
},
174+
extends: ["plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/eslint-recommended"],
175+
rules: {
176+
"@typescript-eslint/no-unused-vars": "off",
177+
},
178+
},
159179
],
160180
};

sdk/communication/communication-recipient-verification/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ import { RecipientVerificationClient } from "@azure-tools/communication-recipien
9292
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
9393
const client = new RecipientVerificationClient(connectionString);
9494

95-
async main function() {
95+
async function main() {
9696
// body of the request
9797
const VerificationRequest = {
9898
identity: "+11234567890",
@@ -114,7 +114,7 @@ import { RecipientVerificationClient } from "@azure-tools/communication-recipien
114114
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
115115
const client = new RecipientVerificationClient(connectionString);
116116

117-
async main function() {
117+
async function main() {
118118
// id that is used to reference users phone number
119119
const verificationId = "7e5dd7e1-5203-41ab-960e-65c1eb804fc6";
120120

@@ -138,7 +138,7 @@ import { RecipientVerificationClient } from "@azure-tools/communication-recipien
138138
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
139139
const client = new RecipientVerificationClient(connectionString);
140140

141-
async main function() {
141+
async function main() {
142142
// id that is used to reference users phone number
143143
const verificationId = "4d313ff0-3aeb-477e-8c15-7c9a893e8999";
144144

@@ -156,7 +156,7 @@ import { RecipientVerificationClient } from "@azure-tools/communication-recipien
156156
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
157157
const client = new RecipientVerificationClient(connectionString);
158158

159-
async main function() {
159+
async function main() {
160160
// get all verifications for a resource
161161
var verifications = await client.getVerifications();
162162

sdk/communication/communication-short-codes/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ import { ShortCodesClient } from "@azure-tools/communication-short-codes";
104104
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
105105
const client = new ShortCodesClient(connectionString);
106106

107-
async main function() {
107+
async function main() {
108108
const programBriefId = "00000000-0000-0000-0000-000000000000";
109109
const programBriefRequest: ShortCodesCreateUSProgramBriefParams = {
110110
body: {
@@ -194,7 +194,7 @@ import { ShortCodesClient } from "@azure-tools/communication-short-codes";
194194
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
195195
const client = new ShortCodesClient(connectionString);
196196

197-
async main function() {
197+
async function main() {
198198
// get all program briefs for a resource
199199
var programBriefs = await client.listUSProgramBriefs();
200200

@@ -230,7 +230,7 @@ import { ShortCodesClient } from "@azure-tools/communication-short-codes";
230230
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
231231
const client = new ShortCodesClient(connectionString);
232232

233-
async main function() {
233+
async function main() {
234234
// get a program briefs for a resource
235235
const programBriefId = process.env.PROGRAM_BRIEF_TO_GET || "<program brief Id>";
236236
var programBrief = await client.getUSProgramBrief(programBriefId);
@@ -267,7 +267,7 @@ import { ShortCodesClient } from "@azure-tools/communication-short-codes";
267267
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
268268
const client = new ShortCodesClient(connectionString);
269269

270-
async main function() {
270+
async function main() {
271271
// get all short codes for a resource
272272
var shortCodes = await client.listShortCodes();
273273

@@ -289,7 +289,7 @@ import { ShortCodesClient } from "@azure-tools/communication-short-codes";
289289
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
290290
const client = new ShortCodesClient(connectionString);
291291

292-
async main function() {
292+
async function main() {
293293
// get all eligible short code costs for a resource
294294
var shortCodeCosts = await client.listShortCodeCosts();
295295

sdk/communication/communication-tiering/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ import { Tiering } from "@azure-tools/communication-tiering";
8484
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
8585
const client = new Tiering(connectionString);
8686

87-
async main function() {
87+
async function main() {
8888
const resourceId = "5d41e908-de88-4bbf-94dc-fe9a1b51029b";
8989

9090
// Get acquired numbers and limits for a resource
@@ -104,7 +104,7 @@ import { Tiering } from "@azure-tools/communication-tiering";
104104
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
105105
const client = new Tiering(connectionString);
106106

107-
async main function() {
107+
async function main() {
108108
const resourceId = "5d41e908-de88-4bbf-94dc-fe9a1b51029b";
109109

110110
// Get tier info for a resource

sdk/identity/identity-broker/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ After calling `useIdentityPlugin`, the native broker plugin is registered to the
7575

7676
Once the plugin is registered, you can enable WAM broker authentication by passing `brokerOptions` with an `enabled` property set to `true` to a credential constructor. In the following example, we use the `InteractiveBrowserCredential`.
7777

78+
<!-- eslint-skip -->
7879
```typescript
7980
import { nativeBrokerPlugin } from "@azure/identity-broker";
8081
import { useIdentityPlugin, InteractiveBrowserCredential } from "@azure/identity";
@@ -108,6 +109,7 @@ For a complete example of using an Electron app for retrieving a window handle,
108109

109110
When the `useDefaultBrokerAccount` option is set to `true`, the credential will attempt to silently use the default broker account. If using the default account fails, the credential will fall back to interactive authentication.
110111

112+
<!-- eslint-skip -->
111113
```typescript
112114
import { nativeBrokerPlugin } from "@azure/identity-broker";
113115
import { useIdentityPlugin, InteractiveBrowserCredential } from "@azure/identity";
@@ -145,7 +147,7 @@ See the Azure Identity [troubleshooting guide][https://github.com/Azure/azure-sd
145147
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
146148

147149
```typescript
148-
import { setLogLevel } from ("@azure/logger");
150+
import { setLogLevel } from "@azure/logger";
149151

150152
setLogLevel("info");
151153
```

sdk/remoterendering/mixed-reality-remote-rendering/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ to be used with a Mixed Reality client library:
141141
// to the client.
142142
const accessToken = GetMixedRealityAccessTokenFromWebService();
143143

144-
RemoteRenderingClient client = new RemoteRenderingClient(remoteRenderingEndpoint, accountId, accessToken);
144+
const client = new RemoteRenderingClient(remoteRenderingEndpoint, accountId, accessToken);
145145
```
146146

147147
## Key concepts
@@ -201,7 +201,7 @@ The code is as follows:
201201
```typescript Snippet:StartAComplexAssetConversion
202202
const inputSettings: AssetConversionInputSettings = {
203203
storageContainerUrl: inputStorageUrl,
204-
blobPrefix: "Bicycle"
204+
blobPrefix: "Bicycle",
205205
relativeInputAssetPath: "bicycle.gltf"
206206
};
207207
const outputSettings: AssetConversionOutputSettings = {

0 commit comments

Comments
 (0)