From cadc46a31c01d1e7217a88947ca804f5f4aeb68e Mon Sep 17 00:00:00 2001 From: wj428 Date: Tue, 15 Feb 2022 21:46:13 -0800 Subject: [PATCH 1/7] added eslint-plugin-markdown --- sdk/textanalytics/ai-text-analytics/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/textanalytics/ai-text-analytics/package.json b/sdk/textanalytics/ai-text-analytics/package.json index 72c2cd22d52d..f021ec4ee0db 100644 --- a/sdk/textanalytics/ai-text-analytics/package.json +++ b/sdk/textanalytics/ai-text-analytics/package.json @@ -73,8 +73,8 @@ "integration-test:browser": "karma start --single-run", "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 5000000 --full-trace \"dist-esm/test/{,!(browser)/**/}*.spec.js\"", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", - "lint": "eslint package.json api-extractor.json src test --ext .ts", + "lint:fix": "eslint README.md package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", + "lint": "eslint README.md package.json api-extractor.json src test --ext .ts", "pack": "npm pack 2>&1", "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser", "test:node": "npm run clean && npm run build:test && npm run unit-test:node", From cf5c5603f8786bcca3cbcd8aaa9d2ab7759bd2a2 Mon Sep 17 00:00:00 2001 From: wj428 Date: Tue, 15 Feb 2022 21:46:25 -0800 Subject: [PATCH 2/7] added eslint-plugin-markdown --- common/config/rush/pnpm-lock.yaml | 101 +++++++++++++++++- .../eslint-plugin-azure-sdk/package.json | 3 +- .../src/configs/azure-sdk-base.ts | 17 ++- 3 files changed, 116 insertions(+), 5 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index b72b191a22aa..3fc09aa8cddc 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -2240,6 +2240,12 @@ packages: '@types/node': 17.0.15 dev: false + /@types/mdast/3.0.10: + resolution: {integrity: sha512-W864tg/Osz1+9f4lrGTZpCSO5/z4608eUp19tbozkq2HJK6i3z1kT0H9tlADXuYIb1YYOBByU4Jsqkk75q48qA==} + dependencies: + '@types/unist': 2.0.6 + dev: false + /@types/mime/1.3.2: resolution: {integrity: sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==} dev: false @@ -2378,6 +2384,10 @@ packages: resolution: {integrity: sha512-uO4CD2ELOjw8tasUrAhvnn2W4A0ZECOvMjCivJr4gA9pGgjv+qxKWY9GLTMVEK8ej85BxQOocUyE7hImmSQYcg==} dev: false + /@types/unist/2.0.6: + resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==} + dev: false + /@types/uuid/8.3.4: resolution: {integrity: sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==} dev: false @@ -3079,6 +3089,18 @@ packages: supports-color: 7.2.0 dev: false + /character-entities-legacy/1.1.4: + resolution: {integrity: sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==} + dev: false + + /character-entities/1.2.4: + resolution: {integrity: sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==} + dev: false + + /character-reference-invalid/1.1.4: + resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==} + dev: false + /charenc/0.0.2: resolution: {integrity: sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=} dev: false @@ -3823,6 +3845,18 @@ packages: tsconfig-paths: 3.12.0 dev: false + /eslint-plugin-markdown/2.2.1_eslint@7.32.0: + resolution: {integrity: sha512-FgWp4iyYvTFxPwfbxofTvXxgzPsDuSKHQy2S+a8Ve6savbujey+lgrFFbXQA0HPygISpRYWYBjooPzhYSF81iA==} + engines: {node: ^8.10.0 || ^10.12.0 || >= 12.0.0} + peerDependencies: + eslint: '>=6.0.0' + dependencies: + eslint: 7.32.0 + mdast-util-from-markdown: 0.8.5 + transitivePeerDependencies: + - supports-color + dev: false + /eslint-plugin-no-only-tests/2.6.0: resolution: {integrity: sha512-T9SmE/g6UV1uZo1oHAqOvL86XWl7Pl2EpRpnLI8g/bkJu+h7XBCB+1LnubRZ2CUQXj805vh4/CYZdnqtVaEo2Q==} engines: {node: '>=4.0.0'} @@ -4839,6 +4873,17 @@ packages: engines: {node: '>= 0.10'} dev: false + /is-alphabetical/1.0.4: + resolution: {integrity: sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==} + dev: false + + /is-alphanumerical/1.0.4: + resolution: {integrity: sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==} + dependencies: + is-alphabetical: 1.0.4 + is-decimal: 1.0.4 + dev: false + /is-arguments/1.1.1: resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==} engines: {node: '>= 0.4'} @@ -4906,6 +4951,10 @@ packages: has-tostringtag: 1.0.0 dev: false + /is-decimal/1.0.4: + resolution: {integrity: sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==} + dev: false + /is-docker/2.2.1: resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} engines: {node: '>=8'} @@ -4955,6 +5004,10 @@ packages: is-extglob: 2.1.1 dev: false + /is-hexadecimal/1.0.4: + resolution: {integrity: sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==} + dev: false + /is-module/1.0.0: resolution: {integrity: sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=} dev: false @@ -5789,6 +5842,22 @@ packages: is-buffer: 1.1.6 dev: false + /mdast-util-from-markdown/0.8.5: + resolution: {integrity: sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==} + dependencies: + '@types/mdast': 3.0.10 + mdast-util-to-string: 2.0.0 + micromark: 2.11.4 + parse-entities: 2.0.0 + unist-util-stringify-position: 2.0.3 + transitivePeerDependencies: + - supports-color + dev: false + + /mdast-util-to-string/2.0.0: + resolution: {integrity: sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==} + dev: false + /media-typer/0.3.0: resolution: {integrity: sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=} engines: {node: '>= 0.6'} @@ -5823,6 +5892,15 @@ packages: engines: {node: '>= 0.6'} dev: false + /micromark/2.11.4: + resolution: {integrity: sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==} + dependencies: + debug: 4.3.3 + parse-entities: 2.0.0 + transitivePeerDependencies: + - supports-color + dev: false + /micromatch/4.0.4: resolution: {integrity: sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==} engines: {node: '>=8.6'} @@ -6454,6 +6532,17 @@ packages: callsites: 3.1.0 dev: false + /parse-entities/2.0.0: + resolution: {integrity: sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==} + dependencies: + character-entities: 1.2.4 + character-entities-legacy: 1.1.4 + character-reference-invalid: 1.1.4 + is-alphanumerical: 1.0.4 + is-decimal: 1.0.4 + is-hexadecimal: 1.0.4 + dev: false + /parse-json/4.0.0: resolution: {integrity: sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=} engines: {node: '>=4'} @@ -8130,6 +8219,12 @@ packages: resolution: {integrity: sha512-ekY1NhRzq0B08g4bGuX4wd2jZx5GnKz6mKSqFL4nqBlfyMGiG10gDFhDTMEfYmDL6Jy0FUIZp7wiRB+0BP7J2g==} dev: false + /unist-util-stringify-position/2.0.3: + resolution: {integrity: sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==} + dependencies: + '@types/unist': 2.0.6 + dev: false + /universal-user-agent/6.0.0: resolution: {integrity: sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==} dev: false @@ -13800,7 +13895,7 @@ packages: dev: false file:projects/eslint-plugin-azure-sdk.tgz: - resolution: {integrity: sha512-L7HkizsdDc/0/ZqKkNo4eNOvRKzmrzg/Ae8eS5hF9Z2fwaHODmXlT2gpmwnhogJjKs31bDA0rhIzp2pGZ/5gsw==, tarball: file:projects/eslint-plugin-azure-sdk.tgz} + resolution: {integrity: sha512-26TYv9uXiTNI5K2te1DDkqCiTDJjONPIPL9WYynLKwkVmfP5GZ+ZrfHWr/Dh+cDuzDr09mCvAh5IRXHEW98SZA==, tarball: file:projects/eslint-plugin-azure-sdk.tgz} name: '@rush-temp/eslint-plugin-azure-sdk' version: 0.0.0 dependencies: @@ -13819,6 +13914,7 @@ packages: eslint: 7.32.0 eslint-config-prettier: 7.2.0_eslint@7.32.0 eslint-plugin-import: 2.25.4_eslint@7.32.0 + eslint-plugin-markdown: 2.2.1_eslint@7.32.0 eslint-plugin-no-only-tests: 2.6.0 eslint-plugin-promise: 4.3.1 eslint-plugin-tsdoc: 0.2.14 @@ -13912,7 +14008,7 @@ packages: dev: false file:projects/eventgrid.tgz: - resolution: {integrity: sha512-cRipNDlfS0co7HptArkxqp6lbNAffyBqpvSVSDhMe/ZR5cBJs6ywzCsV/QxHhxBpp6Z7p5To9h98IYOOIhMp+A==, tarball: file:projects/eventgrid.tgz} + resolution: {integrity: sha512-5cMNL6d3puoJz7tLWxl1yyAwtd3EI7uAMvn+q3AAyZHJFG7WdS3l7IfCL8i8LD2qvRdpRJxm88jqVsLU3oA+Eg==, tarball: file:projects/eventgrid.tgz} name: '@rush-temp/eventgrid' version: 0.0.0 dependencies: @@ -13960,7 +14056,6 @@ packages: - '@swc/wasm' - bufferutil - debug - - encoding - supports-color - utf-8-validate dev: false diff --git a/common/tools/eslint-plugin-azure-sdk/package.json b/common/tools/eslint-plugin-azure-sdk/package.json index 6eb3ab9ee5c6..fe116ca3d424 100644 --- a/common/tools/eslint-plugin-azure-sdk/package.json +++ b/common/tools/eslint-plugin-azure-sdk/package.json @@ -93,6 +93,7 @@ "rimraf": "^3.0.0", "source-map-support": "^0.5.9", "mocha-junit-reporter": "^2.0.0", - "typescript": "~4.2.0" + "typescript": "~4.2.0", + "eslint-plugin-markdown": "~2.2.1" } } diff --git a/common/tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts b/common/tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts index 0c3254537588..250d3fec8b64 100644 --- a/common/tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts +++ b/common/tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts @@ -11,7 +11,7 @@ export default { sourceType: "module", extraFileExtensions: [".json"], }, - plugins: ["@typescript-eslint", "no-only-tests", "promise", "eslint-plugin-tsdoc", "import"], + plugins: ["@typescript-eslint", "no-only-tests", "promise", "eslint-plugin-tsdoc", "import", "markdown"], extends: [ "plugin:@typescript-eslint/recommended", "eslint:recommended", @@ -20,6 +20,7 @@ export default { "prettier", "prettier/@typescript-eslint", "plugin:@azure/azure-sdk/recommended", + "plugin:markdown/recommended" ], env: { mocha: true, @@ -124,4 +125,18 @@ export default { "@azure/azure-sdk/ts-doc-internal": "off", "tsdoc/syntax": "error", }, + "overrides": [ + { + files: ["**/*.md"], + processor: "markdown/markdown" + }, + { + files: ["**/*.md/*.js"], + rules: { + "no-restricted-imports": [ + "error", { "patterns": ["**/**", "@azure/logger"] } + ], + } + } + ] }; From 6e332000d3c7370c1f50eff188abd8e7108adb1d Mon Sep 17 00:00:00 2001 From: wj428 Date: Sun, 20 Feb 2022 15:28:30 -0800 Subject: [PATCH 3/7] configured ts and js lint differently in override --- .../src/configs/azure-sdk-base.ts | 236 +++++++++--------- .../ai-text-analytics/package.json | 4 +- 2 files changed, 126 insertions(+), 114 deletions(-) diff --git a/common/tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts b/common/tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts index 250d3fec8b64..a3ecdd71d216 100644 --- a/common/tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts +++ b/common/tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts @@ -4,138 +4,150 @@ export default { parser: "@typescript-eslint/parser", parserOptions: { - project: [ - "./tsconfig.json", - "../../../common/tools/eslint-plugin-azure-sdk/tsconfig.lintjson.json", - ], sourceType: "module", - extraFileExtensions: [".json"], + extraFileExtensions: [".json", ".javascript"], }, plugins: ["@typescript-eslint", "no-only-tests", "promise", "eslint-plugin-tsdoc", "import", "markdown"], extends: [ - "plugin:@typescript-eslint/recommended", "eslint:recommended", "plugin:promise/recommended", - "plugin:@typescript-eslint/eslint-recommended", "prettier", - "prettier/@typescript-eslint", - "plugin:@azure/azure-sdk/recommended", - "plugin:markdown/recommended" ], env: { mocha: true, }, ignorePatterns: ["**/generated/**"], - rules: { - curly: ["error", "multi-line"], - "eol-last": ["error", "always"], - eqeqeq: ["error", "always", { null: "ignore" }], - "import/no-extraneous-dependencies": [ - "error", - { - devDependencies: ["test/**/*.ts", "samples/**", "**/karma.conf.js", "**/.eslintrc.js"], - optionalDependencies: false, - peerDependencies: false, + "overrides": [ + { + files: ['*.ts', '*.tsx'], + parserOptions: { + project: [ + "./tsconfig.json", + "../../../common/tools/eslint-plugin-azure-sdk/tsconfig.lintjson.json", + ] }, - ], - "no-console": "off", - "no-dupe-class-members": "off", - "no-invalid-this": "off", - "no-empty": "error", - "no-fallthrough": "error", - "@typescript-eslint/no-invalid-this": "error", - "@typescript-eslint/no-require-imports": "error", - "no-restricted-imports": ["error", { paths: ["rhea", "rhea/.*"] }], - "no-return-await": "error", - "no-undef": "off", - "no-unsafe-finally": "error", - "no-unused-vars": "off", - "no-unused-expressions": "error", - "no-useless-constructor": "off", - "no-use-before-define": "off", - "@typescript-eslint/no-use-before-define": ["error", { functions: false, classes: false }], - "no-var": "error", - "one-var-declaration-per-line": "error", - "prefer-const": "error", - "sort-imports": "warn", - "spaced-comment": ["error", "always", { markers: ["/"] }], - "space-infix-ops": ["error", { int32Hint: false }], - "use-isnan": "error", - "no-only-tests/no-only-tests": "error", - "@typescript-eslint/explicit-module-boundary-types": ["error"], - "no-redeclare": "off", - "@typescript-eslint/no-redeclare": ["error", { builtinGlobals: true }], - "@typescript-eslint/camelcase": "off", - "@typescript-eslint/naming-convention": [ - "error", - { selector: "default", format: null }, - { selector: ["class", "interface"], format: ["PascalCase"] }, - { - selector: "interface", - format: ["PascalCase"], - custom: { - regex: "^I[A-Z]", - match: false, - }, + extends: [ + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/eslint-recommended", + "prettier/@typescript-eslint", + "plugin:@azure/azure-sdk/recommended", + ], + rules: { + curly: ["error", "multi-line"], + "eol-last": ["error", "always"], + eqeqeq: ["error", "always", { null: "ignore" }], + "import/no-extraneous-dependencies": [ + "error", + { + devDependencies: ["test/**/*.ts", "samples/**", "**/karma.conf.js", "**/.eslintrc.js"], + optionalDependencies: false, + peerDependencies: false, + }, + ], + "no-console": "off", + "no-dupe-class-members": "off", + "no-invalid-this": "off", + "no-empty": "error", + "no-fallthrough": "error", + "@typescript-eslint/no-invalid-this": "error", + "@typescript-eslint/no-require-imports": "error", + "no-restricted-imports": ["error", { paths: ["rhea", "rhea/.*"] }], + "no-return-await": "error", + "no-undef": "off", + "no-unsafe-finally": "error", + "no-unused-vars": "off", + "no-unused-expressions": "error", + "no-useless-constructor": "off", + "no-use-before-define": "off", + "@typescript-eslint/no-use-before-define": ["error", { functions: false, classes: false }], + "no-var": "error", + "one-var-declaration-per-line": "error", + "prefer-const": "error", + "sort-imports": "warn", + "spaced-comment": ["error", "always", { markers: ["/"] }], + "space-infix-ops": ["error", { int32Hint: false }], + "use-isnan": "error", + "no-only-tests/no-only-tests": "error", + "@typescript-eslint/explicit-module-boundary-types": ["error"], + "no-redeclare": "off", + "@typescript-eslint/no-redeclare": ["error", { builtinGlobals: true }], + "@typescript-eslint/camelcase": "off", + "@typescript-eslint/naming-convention": [ + "error", + { selector: "default", format: null }, + { selector: ["class", "interface"], format: ["PascalCase"] }, + { + selector: "interface", + format: ["PascalCase"], + custom: { + regex: "^I[A-Z]", + match: false, + }, + }, + ], + "@typescript-eslint/no-angle-bracket-type-assertion": "off", + "@typescript-eslint/no-array-constructor": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/explicit-function-return-type": [ + "warn", + { allowExpressions: true, allowTypedFunctionExpressions: true }, + ], + "@typescript-eslint/explicit-member-accessibility": "off", + "@typescript-eslint/no-inferrable-types": "off", + // We use empty extends and empty interface for shimming and renaming extensively + "@typescript-eslint/no-empty-interface": "off", + "@typescript-eslint/no-namespace": "error", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], + "@typescript-eslint/no-useless-constructor": "error", + "@typescript-eslint/no-var-requires": "off", + "no-shadow": "off", + "@typescript-eslint/no-shadow": ["error", { ignoreTypeValueShadow: true }], + // https://github.com/Azure/azure-sdk-for-js/issues/7608 + // "@typescript-eslint/member-ordering": [ + // "error", + // { + // default: [ + // "instance-method", + // "method", + // "private-instance-method", + // "private-method", + // "private-static-method", + // "protected-instance-method", + // "protected-method", + // "protected-static-method", + // "public-instance-method", + // "public-method", + // "public-static-method", + // "static-method" + // ] + // } + // ], + // https://github.com/Azure/azure-sdk-for-js/issues/7605 + "@azure/azure-sdk/ts-apisurface-supportcancellation": "off", + // https://github.com/Azure/azure-sdk-for-js/issues/7609 + "@azure/azure-sdk/ts-pagination-list": "off", + // https://github.com/Azure/azure-sdk-for-js/issues/7610 + "@azure/azure-sdk/ts-doc-internal": "off", + "tsdoc/syntax": "error", }, - ], - "@typescript-eslint/no-angle-bracket-type-assertion": "off", - "@typescript-eslint/no-array-constructor": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/explicit-function-return-type": [ - "warn", - { allowExpressions: true, allowTypedFunctionExpressions: true }, - ], - "@typescript-eslint/explicit-member-accessibility": "off", - "@typescript-eslint/no-inferrable-types": "off", - // We use empty extends and empty interface for shimming and renaming extensively - "@typescript-eslint/no-empty-interface": "off", - "@typescript-eslint/no-namespace": "error", - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], - "@typescript-eslint/no-useless-constructor": "error", - "@typescript-eslint/no-var-requires": "off", - "no-shadow": "off", - "@typescript-eslint/no-shadow": ["error", { ignoreTypeValueShadow: true }], - // https://github.com/Azure/azure-sdk-for-js/issues/7608 - // "@typescript-eslint/member-ordering": [ - // "error", - // { - // default: [ - // "instance-method", - // "method", - // "private-instance-method", - // "private-method", - // "private-static-method", - // "protected-instance-method", - // "protected-method", - // "protected-static-method", - // "public-instance-method", - // "public-method", - // "public-static-method", - // "static-method" - // ] - // } - // ], - // https://github.com/Azure/azure-sdk-for-js/issues/7605 - "@azure/azure-sdk/ts-apisurface-supportcancellation": "off", - // https://github.com/Azure/azure-sdk-for-js/issues/7609 - "@azure/azure-sdk/ts-pagination-list": "off", - // https://github.com/Azure/azure-sdk-for-js/issues/7610 - "@azure/azure-sdk/ts-doc-internal": "off", - "tsdoc/syntax": "error", - }, - "overrides": [ + }, { files: ["**/*.md"], processor: "markdown/markdown" }, { - files: ["**/*.md/*.js"], + files: ["**/*.md/*.{js,javascript}"], + extends: [ + "plugin:markdown/recommended" + ], rules: { - "no-restricted-imports": [ - "error", { "patterns": ["**/**", "@azure/logger"] } - ], + "no-restricted-imports": ["error", { + "patterns": [{ + "group": ["*"], + "message": "Please use require instead of import." + }], + }] } } ] diff --git a/sdk/textanalytics/ai-text-analytics/package.json b/sdk/textanalytics/ai-text-analytics/package.json index f021ec4ee0db..3ca846bd544a 100644 --- a/sdk/textanalytics/ai-text-analytics/package.json +++ b/sdk/textanalytics/ai-text-analytics/package.json @@ -73,8 +73,8 @@ "integration-test:browser": "karma start --single-run", "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 5000000 --full-trace \"dist-esm/test/{,!(browser)/**/}*.spec.js\"", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "lint:fix": "eslint README.md package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", - "lint": "eslint README.md package.json api-extractor.json src test --ext .ts", + "lint:fix": "eslint README.md package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", + "lint": "eslint README.md package.json api-extractor.json src test", "pack": "npm pack 2>&1", "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser", "test:node": "npm run clean && npm run build:test && npm run unit-test:node", From 491d2bba04943a2ad1319b88c95afd2971ead48f Mon Sep 17 00:00:00 2001 From: wj428 Date: Sun, 20 Feb 2022 15:48:59 -0800 Subject: [PATCH 4/7] fixed --ext --- sdk/textanalytics/ai-text-analytics/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/textanalytics/ai-text-analytics/package.json b/sdk/textanalytics/ai-text-analytics/package.json index 3ca846bd544a..811baaed62f6 100644 --- a/sdk/textanalytics/ai-text-analytics/package.json +++ b/sdk/textanalytics/ai-text-analytics/package.json @@ -73,8 +73,8 @@ "integration-test:browser": "karma start --single-run", "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 5000000 --full-trace \"dist-esm/test/{,!(browser)/**/}*.spec.js\"", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "lint:fix": "eslint README.md package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", - "lint": "eslint README.md package.json api-extractor.json src test", + "lint:fix": "eslint README.md package.json api-extractor.json src test --ext .ts,.md,.javascript,.js --fix --fix-type [problem,suggestion]", + "lint": "eslint README.md package.json api-extractor.json src test --ext .ts,.md,.javascript,.js", "pack": "npm pack 2>&1", "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser", "test:node": "npm run clean && npm run build:test && npm run unit-test:node", From 4fe4737965d355787475795bdec297983db8f057 Mon Sep 17 00:00:00 2001 From: wj428 Date: Mon, 21 Feb 2022 16:58:17 -0800 Subject: [PATCH 5/7] fixed README.md error in sdk\textanalytics\ai-text-analytics\README.md --- sdk/textanalytics/ai-text-analytics/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/textanalytics/ai-text-analytics/README.md b/sdk/textanalytics/ai-text-analytics/README.md index 3b8672b8e0db..42790a523cd3 100644 --- a/sdk/textanalytics/ai-text-analytics/README.md +++ b/sdk/textanalytics/ai-text-analytics/README.md @@ -510,7 +510,7 @@ main(); 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`: ```javascript -import { setLogLevel } from "@azure/logger"; +const { logger } = require("@azure/logger"); setLogLevel("info"); ``` From 32ed0c157f382afc9c211aee702dac4181e56df3 Mon Sep 17 00:00:00 2001 From: wj428 Date: Sun, 27 Feb 2022 11:42:47 -0800 Subject: [PATCH 6/7] added json to override --- .../tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts b/common/tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts index a3ecdd71d216..c448086531f7 100644 --- a/common/tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts +++ b/common/tools/eslint-plugin-azure-sdk/src/configs/azure-sdk-base.ts @@ -19,7 +19,7 @@ export default { ignorePatterns: ["**/generated/**"], "overrides": [ { - files: ['*.ts', '*.tsx'], + files: ['*.ts', '*.tsx', '*.json'], parserOptions: { project: [ "./tsconfig.json", From 3c0e2df0008a27ced01d227bc1a333de83a3c868 Mon Sep 17 00:00:00 2001 From: wj428 Date: Tue, 1 Mar 2022 16:14:23 -0800 Subject: [PATCH 7/7] removed --ext option in package.json --- sdk/textanalytics/ai-text-analytics/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/textanalytics/ai-text-analytics/package.json b/sdk/textanalytics/ai-text-analytics/package.json index eca7cab920b4..7c337e4cfb29 100644 --- a/sdk/textanalytics/ai-text-analytics/package.json +++ b/sdk/textanalytics/ai-text-analytics/package.json @@ -70,8 +70,8 @@ "integration-test:browser": "dev-tool run test:browser", "integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 \"dist-esm/test/**/*.spec.js\"", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "lint:fix": "eslint README.md package.json api-extractor.json src test --ext .ts,.md,.javascript,.js --fix --fix-type [problem,suggestion]", - "lint": "eslint README.md package.json api-extractor.json src test --ext .ts,.md,.javascript,.js", + "lint:fix": "eslint README.md package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", + "lint": "eslint README.md package.json api-extractor.json src test", "pack": "npm pack 2>&1", "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser", "test:node": "npm run clean && npm run build:test && npm run unit-test:node",