diff --git a/.default-eslintrc.yaml b/.default-eslintrc.yaml index ddf76dc16..911667344 100644 --- a/.default-eslintrc.yaml +++ b/.default-eslintrc.yaml @@ -6,6 +6,7 @@ plugins: - unicorn - node - jest + - import env: es6: true @@ -16,6 +17,9 @@ extends: - plugin:@typescript-eslint/recommended - plugin:node/recommended - plugin:jest/recommended + - plugin:jest/recommended + - plugin:import/recommended + - plugin:import/typescript globals: Atomics: readonly @@ -27,30 +31,30 @@ parserOptions: project: ./tsconfig.json rules: - "@typescript-eslint/no-this-alias": "off" - "@typescript-eslint/interface-name-prefix": "off" - "@typescript-eslint/explicit-function-return-type": "off" - "@typescript-eslint/no-explicit-any": "off" - "@typescript-eslint/no-empty-interface": "off" - "@typescript-eslint/no-namespace": "off" - "@typescript-eslint/explicit-member-accessibility": "off" - "@typescript-eslint/no-unused-vars": "off" - "@typescript-eslint/no-parameter-properties": "off" - "@typescript-eslint/no-angle-bracket-type-assertion": "off" - "@typescript-eslint/no-use-before-define": "off" - "@typescript-eslint/no-var-requires": "off" - "@typescript-eslint/no-empty-function": "off" - "@typescript-eslint/explicit-module-boundary-types": "off" - "@typescript-eslint/ban-types": "off" - "@typescript-eslint/consistent-type-assertions": "off" - "@typescript-eslint/no-floating-promises": "warn" + "@typescript-eslint/no-this-alias": off + "@typescript-eslint/interface-name-prefix": off + "@typescript-eslint/explicit-function-return-type": off + "@typescript-eslint/no-explicit-any": off + "@typescript-eslint/no-empty-interface": off + "@typescript-eslint/no-namespace": off + "@typescript-eslint/explicit-member-accessibility": off + "@typescript-eslint/no-unused-vars": off + "@typescript-eslint/no-parameter-properties": off + "@typescript-eslint/no-angle-bracket-type-assertion": off + "@typescript-eslint/no-use-before-define": off + "@typescript-eslint/no-var-requires": off + "@typescript-eslint/no-empty-function": off + "@typescript-eslint/explicit-module-boundary-types": off + "@typescript-eslint/ban-types": off + "@typescript-eslint/consistent-type-assertions": off + "@typescript-eslint/no-floating-promises": warn - "require-atomic-updates": "off" + "require-atomic-updates": off # Prettier config https://github.com/prettier/eslint-plugin-prettier#recommended-configuration - prettier/prettier: "warn" - arrow-body-style: "off" - prefer-arrow-callback: "off" + prettier/prettier: warn + arrow-body-style: off + prefer-arrow-callback: off # Unicorn plugin config unicorn/filename-case: warn @@ -75,10 +79,24 @@ rules: jest/no-focused-tests: warn jest/no-identical-title: warn + # ================================================= + # Import plugin + # ================================================= + import/no-default-export: warn + import/no-self-import: warn # This cause many circular dependency issues with index files. + import/no-internal-modules: off + import/no-unresolved: off + import/order: + - warn + - groups: ["builtin", "external", "parent", "sibling", "index"] + alphabetize: + order: "asc" + caseInsensitive: true + # Basic config no-console: warn - no-undef: "off" - no-unused-vars: "off" + no-undef: off + no-unused-vars: off no-multiple-empty-lines: - warn - max: 2 diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 9873da698..5acb022c9 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -65,7 +65,7 @@ dependencies: deep-equal: 2.0.5 diff: 4.0.2 eslint: 7.21.0 - eslint-plugin-import: 2.22.1_eslint@7.21.0 + eslint-plugin-import: 2.24.2_eslint@7.21.0 eslint-plugin-jest: 24.3.2_0a8bb714dcb5eb15815cf9c1a5256ac7 eslint-plugin-node: 11.1.0_eslint@7.21.0 eslint-plugin-prettier: 3.4.0_eslint@7.21.0+prettier@2.3.1 @@ -2391,12 +2391,6 @@ packages: dev: false resolution: integrity: sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= - /contains-path/0.1.0: - dev: false - engines: - node: '>=0.10.0' - resolution: - integrity: sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= /content-disposition/0.5.3: dependencies: safe-buffer: 5.1.2 @@ -2796,15 +2790,14 @@ packages: node: '>=8' resolution: integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== - /doctrine/1.5.0: + /doctrine/2.1.0: dependencies: esutils: 2.0.3 - isarray: 1.0.0 dev: false engines: node: '>=0.10.0' resolution: - integrity: sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= + integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== /doctrine/3.0.0: dependencies: esutils: 2.0.3 @@ -2954,6 +2947,30 @@ packages: node: '>= 0.4' resolution: integrity: sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw== + /es-abstract/1.18.5: + dependencies: + call-bind: 1.0.2 + es-to-primitive: 1.2.1 + function-bind: 1.1.1 + get-intrinsic: 1.1.1 + has: 1.0.3 + has-symbols: 1.0.2 + internal-slot: 1.0.3 + is-callable: 1.2.3 + is-negative-zero: 2.0.1 + is-regex: 1.1.4 + is-string: 1.0.7 + object-inspect: 1.11.0 + object-keys: 1.1.1 + object.assign: 4.1.2 + string.prototype.trimend: 1.0.4 + string.prototype.trimstart: 1.0.4 + unbox-primitive: 1.0.1 + dev: false + engines: + node: '>= 0.4' + resolution: + integrity: sha512-DDggyJLoS91CkJjgauM5c0yZMjiD1uK3KcaCeAmffGwZ+ODWzOkPN4QwRbsK5DOFf06fywmyLci3ZD8jLGhVYA== /es-get-iterator/1.1.2: dependencies: call-bind: 1.0.2 @@ -3053,22 +3070,22 @@ packages: source-map: 0.6.1 resolution: integrity: sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw== - /eslint-import-resolver-node/0.3.4: + /eslint-import-resolver-node/0.3.6: dependencies: - debug: 2.6.9 + debug: 3.2.7 resolve: 1.20.0 dev: false resolution: - integrity: sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA== - /eslint-module-utils/2.6.0: + integrity: sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw== + /eslint-module-utils/2.6.2: dependencies: - debug: 2.6.9 + debug: 3.2.7 pkg-dir: 2.0.0 dev: false engines: node: '>=4' resolution: - integrity: sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA== + integrity: sha512-QG8pcgThYOuqxupd06oYTZoNOGaUdTY1PqK+oS6ElF6vs4pBdk/aYxFVQQXzcrAqp9m7cl7lb2ubazX+g16k2Q== /eslint-plugin-es/3.0.1_eslint@7.21.0: dependencies: eslint: 7.21.0 @@ -3081,29 +3098,31 @@ packages: eslint: '>=4.19.1' resolution: integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ== - /eslint-plugin-import/2.22.1_eslint@7.21.0: + /eslint-plugin-import/2.24.2_eslint@7.21.0: dependencies: array-includes: 3.1.3 array.prototype.flat: 1.2.4 - contains-path: 0.1.0 debug: 2.6.9 - doctrine: 1.5.0 + doctrine: 2.1.0 eslint: 7.21.0 - eslint-import-resolver-node: 0.3.4 - eslint-module-utils: 2.6.0 + eslint-import-resolver-node: 0.3.6 + eslint-module-utils: 2.6.2 + find-up: 2.1.0 has: 1.0.3 + is-core-module: 2.6.0 minimatch: 3.0.4 - object.values: 1.1.3 - read-pkg-up: 2.0.0 + object.values: 1.1.4 + pkg-up: 2.0.0 + read-pkg-up: 3.0.0 resolve: 1.20.0 - tsconfig-paths: 3.9.0 + tsconfig-paths: 3.11.0 dev: false engines: node: '>=4' peerDependencies: eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 resolution: - integrity: sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw== + integrity: sha512-hNVtyhiEtZmpsabL4neEj+6M5DCLgpYyG9nzJY8lZQeQXEn5UPW1DpUdsMHMXsq98dbNm7nt1w9ZMSVpfJdi8Q== /eslint-plugin-jest/24.3.2_0a8bb714dcb5eb15815cf9c1a5256ac7: dependencies: '@typescript-eslint/eslint-plugin': 4.17.0_8b165b9e54250ab9ac320f8b5af3f123 @@ -4025,6 +4044,14 @@ packages: node: '>= 0.4' resolution: integrity: sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== + /has-tostringtag/1.0.0: + dependencies: + has-symbols: 1.0.2 + dev: false + engines: + node: '>= 0.4' + resolution: + integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== /has-unicode/2.0.1: dev: false resolution: @@ -4276,6 +4303,16 @@ packages: dev: false resolution: integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== + /internal-slot/1.0.3: + dependencies: + get-intrinsic: 1.1.1 + has: 1.0.3 + side-channel: 1.0.4 + dev: false + engines: + node: '>= 0.4' + resolution: + integrity: sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA== /interpret/2.2.0: dev: false engines: @@ -4383,12 +4420,12 @@ packages: hasBin: true resolution: integrity: sha512-kDXyttuLeslKAHYL/K28F2YkM3x5jvFPEw3yXbRptXydjD9rpLEz+C5K5iutY9ZiUu6AP41JdvRQwF4Iqs4ZCQ== - /is-core-module/2.2.0: + /is-core-module/2.6.0: dependencies: has: 1.0.3 dev: false resolution: - integrity: sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ== + integrity: sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ== /is-data-descriptor/0.1.4: dependencies: kind-of: 3.2.2 @@ -4556,6 +4593,15 @@ packages: node: '>= 0.4' resolution: integrity: sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg== + /is-regex/1.1.4: + dependencies: + call-bind: 1.0.2 + has-tostringtag: 1.0.0 + dev: false + engines: + node: '>= 0.4' + resolution: + integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== /is-relative/1.0.0: dependencies: is-unc-path: 1.0.0 @@ -4586,6 +4632,14 @@ packages: node: '>= 0.4' resolution: integrity: sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== + /is-string/1.0.7: + dependencies: + has-tostringtag: 1.0.0 + dev: false + engines: + node: '>= 0.4' + resolution: + integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== /is-symbol/1.0.3: dependencies: has-symbols: 1.0.2 @@ -5576,17 +5630,6 @@ packages: dev: false resolution: integrity: sha512-s9TWOlKxS78mTWrL8zIdqm53YXJ+yjVSXCdvCGnYWtRjRlK2dG0wW+sYrffnw/qveAjY2jM0Y6x2ZteNlrsjXA== - /load-json-file/2.0.0: - dependencies: - graceful-fs: 4.2.6 - parse-json: 2.2.0 - pify: 2.3.0 - strip-bom: 3.0.0 - dev: false - engines: - node: '>=4' - resolution: - integrity: sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= /load-json-file/4.0.0: dependencies: graceful-fs: 4.2.6 @@ -6424,6 +6467,10 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-fn2Fi3gb18mRpBupde04EnVOmYw= + /object-inspect/1.11.0: + dev: false + resolution: + integrity: sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg== /object-inspect/1.9.0: dev: false resolution: @@ -6491,17 +6538,16 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= - /object.values/1.1.3: + /object.values/1.1.4: dependencies: call-bind: 1.0.2 define-properties: 1.1.3 - es-abstract: 1.18.0 - has: 1.0.3 + es-abstract: 1.18.5 dev: false engines: node: '>= 0.4' resolution: - integrity: sha512-nkF6PfDB9alkOUxpf1HNm/QlkeW3SReqL5WXeBLpEJJnlPSvRaDQpW3gQTksTN3fgJX4hL42RzKyOin6ff3tyw== + integrity: sha512-TnGo7j4XSnKQoK3MfvkzqKCi0nVe/D9I9IjwTNYdb/fxYHpjrluHVOgw0AF6jrRFGMPHdfuidR09tIDiIvnaSg== /on-finished/2.3.0: dependencies: ee-first: 1.1.1 @@ -6701,14 +6747,6 @@ packages: node: '>=6' resolution: integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== - /parse-json/2.2.0: - dependencies: - error-ex: 1.3.2 - dev: false - engines: - node: '>=0.10.0' - resolution: - integrity: sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= /parse-json/4.0.0: dependencies: error-ex: 1.3.2 @@ -6787,14 +6825,6 @@ packages: dev: false resolution: integrity: sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= - /path-type/2.0.0: - dependencies: - pify: 2.3.0 - dev: false - engines: - node: '>=4' - resolution: - integrity: sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= /path-type/3.0.0: dependencies: pify: 3.0.0 @@ -6821,12 +6851,6 @@ packages: node: '>=8.6' resolution: integrity: sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== - /pify/2.3.0: - dev: false - engines: - node: '>=0.10.0' - resolution: - integrity: sha1-7RQaasBDqEnqWISY59yosVMw6Qw= /pify/3.0.0: dev: false engines: @@ -6863,6 +6887,14 @@ packages: node: '>=8' resolution: integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== + /pkg-up/2.0.0: + dependencies: + find-up: 2.1.0 + dev: false + engines: + node: '>=4' + resolution: + integrity: sha1-yBmscoBZpGHKscOImivjxJoATX8= /pluralize/8.0.0: dev: false engines: @@ -7105,15 +7137,6 @@ packages: dev: false resolution: integrity: sha512-NAnt2iGDXohE5LI7uBnLnqvLQMtzhkiAOLXTmv+qnF9Ky7xAPcX8Up/xWIhxvLVGJvuLiNc4xQLtuqDRzb4fSA== - /read-pkg-up/2.0.0: - dependencies: - find-up: 2.1.0 - read-pkg: 2.0.0 - dev: false - engines: - node: '>=4' - resolution: - integrity: sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= /read-pkg-up/3.0.0: dependencies: find-up: 2.1.0 @@ -7133,16 +7156,6 @@ packages: node: '>=8' resolution: integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg== - /read-pkg/2.0.0: - dependencies: - load-json-file: 2.0.0 - normalize-package-data: 2.5.0 - path-type: 2.0.0 - dev: false - engines: - node: '>=4' - resolution: - integrity: sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= /read-pkg/3.0.0: dependencies: load-json-file: 4.0.0 @@ -7308,7 +7321,7 @@ packages: integrity: sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= /resolve/1.20.0: dependencies: - is-core-module: 2.2.0 + is-core-module: 2.6.0 path-parse: 1.0.6 dev: false resolution: @@ -7545,7 +7558,7 @@ packages: dependencies: call-bind: 1.0.2 get-intrinsic: 1.1.1 - object-inspect: 1.9.0 + object-inspect: 1.11.0 dev: false resolution: integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== @@ -8333,6 +8346,15 @@ packages: typescript: '>=2.7' resolution: integrity: sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg== + /tsconfig-paths/3.11.0: + dependencies: + '@types/json5': 0.0.29 + json5: 1.0.1 + minimist: 1.2.5 + strip-bom: 3.0.0 + dev: false + resolution: + integrity: sha512-7ecdYDnIdmv639mmDwslG6KQg1Z9STTz1j7Gcz0xa+nshh/gKDAHcPxRbWOsA3SPp0tXP2leTcY9Kw+NAkfZzA== /tsconfig-paths/3.9.0: dependencies: '@types/json5': 0.0.29 @@ -8340,6 +8362,7 @@ packages: minimist: 1.2.5 strip-bom: 3.0.0 dev: false + optional: true resolution: integrity: sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw== /tslib/1.14.1: @@ -8460,6 +8483,15 @@ packages: dev: false resolution: integrity: sha512-P/51NX+JXyxK/aigg1/ZgyccdAxm5K1+n8+tvqSntjOivPt19gvm1VC49RWYetsiub8WViUchdxl/KWHHB0kzA== + /unbox-primitive/1.0.1: + dependencies: + function-bind: 1.1.1 + has-bigints: 1.0.1 + has-symbols: 1.0.2 + which-boxed-primitive: 1.0.2 + dev: false + resolution: + integrity: sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw== /unc-path-regex/0.1.2: dev: false engines: @@ -8815,7 +8847,7 @@ packages: is-bigint: 1.0.1 is-boolean-object: 1.1.0 is-number-object: 1.0.4 - is-string: 1.0.5 + is-string: 1.0.7 is-symbol: 1.0.3 dev: false resolution: @@ -9609,7 +9641,7 @@ packages: commonmark: 0.27.0 deep-equal: 2.0.5 eslint: 7.21.0 - eslint-plugin-import: 2.22.1_eslint@7.21.0 + eslint-plugin-import: 2.24.2_eslint@7.21.0 eslint-plugin-jest: 24.3.2_0a8bb714dcb5eb15815cf9c1a5256ac7 eslint-plugin-node: 11.1.0_eslint@7.21.0 eslint-plugin-prettier: 3.4.0_eslint@7.21.0+prettier@2.3.1 @@ -9632,7 +9664,7 @@ packages: peerDependencies: ts-node: '*' resolution: - integrity: sha512-XJl3yCgzS08OY5jfzAcjZsm+cyOGJCh0pKyX7H07x7KKy6SQVS4ZatI7eW36OiBxwG00nvt/bbgPUbHFZ7TC2Q== + integrity: sha512-grjTCGc9nHmVHbEGtUNz3+6lA9xo9NEtpf+Hx3RP/td8rOQYXx6x1Wq3epAQzR7n13dPAlM4SSMlM/QTyCZ3gA== tarball: file:projects/md-mock-api.tgz version: 0.0.0 file:projects/modelerfour.tgz_ts-node@9.1.1: @@ -9738,6 +9770,7 @@ packages: '@types/node': 14.14.34 '@types/source-map-support': 0.5.3 eslint: 7.21.0 + eslint-plugin-import: 2.24.2_eslint@7.21.0 eslint-plugin-prettier: 3.4.0_eslint@7.21.0+prettier@2.3.1 eslint-plugin-unicorn: 33.0.1_eslint@7.21.0 rimraf: 3.0.2 @@ -9748,7 +9781,7 @@ packages: peerDependencies: prettier: '*' resolution: - integrity: sha512-q4eWVN2JgEqV44q37qKt2J5sz7T3XDAMZuk7VJZKuQyc+v6pmFke8a/0QnqXEbuajSCTJ7SGuRK5+JG9DtBA/g== + integrity: sha512-eTDjZSb7zXm6+9CygL2dBAZnmpWyDjzUtGIykQ6ZV7LYy7496AwpZBpnlFQQOBnx30ovGKgnBXCfujua/829Cw== tarball: file:projects/test-public-packages.tgz version: 0.0.0 file:projects/test-utils.tgz_prettier@2.3.1+ts-node@9.1.1: @@ -9869,7 +9902,7 @@ specifiers: deep-equal: ^2.0.5 diff: ^4.0.1 eslint: ^7.17.0 - eslint-plugin-import: ~2.22.1 + eslint-plugin-import: ~2.24.2 eslint-plugin-jest: ~24.3.2 eslint-plugin-node: ~11.1.0 eslint-plugin-prettier: ~3.4.0 diff --git a/packages/apps/autorest/package.json b/packages/apps/autorest/package.json index 21d015068..f4bbafa3e 100644 --- a/packages/apps/autorest/package.json +++ b/packages/apps/autorest/package.json @@ -61,6 +61,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "jsonpath": "1.0.0", diff --git a/packages/apps/autorest/src/actions/check-autorest-update.ts b/packages/apps/autorest/src/actions/check-autorest-update.ts index ea428cb1a..b659c7c1e 100644 --- a/packages/apps/autorest/src/actions/check-autorest-update.ts +++ b/packages/apps/autorest/src/actions/check-autorest-update.ts @@ -1,5 +1,5 @@ -import { Package } from "@azure-tools/extension"; import { color } from "@autorest/common"; +import { Package } from "@azure-tools/extension"; import { gt } from "semver"; import { AutorestArgs } from "../args"; import { extensionManager, networkEnabled } from "../autorest-as-a-service"; diff --git a/packages/apps/autorest/src/actions/clear-temp-data.ts b/packages/apps/autorest/src/actions/clear-temp-data.ts index ac002131a..d1129d2de 100644 --- a/packages/apps/autorest/src/actions/clear-temp-data.ts +++ b/packages/apps/autorest/src/actions/clear-temp-data.ts @@ -1,7 +1,7 @@ -import { isDirectory, readdir, rmdir } from "@azure-tools/async-io"; -import chalk from "chalk"; import { tmpdir } from "os"; import { join } from "path"; +import { isDirectory, readdir, rmdir } from "@azure-tools/async-io"; +import chalk from "chalk"; /** * Clears out all autorest-temp folders from the temp folder. diff --git a/packages/apps/autorest/src/app.ts b/packages/apps/autorest/src/app.ts index b63adb929..829f2cf0a 100644 --- a/packages/apps/autorest/src/app.ts +++ b/packages/apps/autorest/src/app.ts @@ -10,12 +10,12 @@ declare const isDebuggerEnabled: boolean; const cwd = process.cwd(); import chalk from "chalk"; -import { newCorePackage, ensureAutorestHome, runCoreWithRequire, runCoreOutOfProc } from "./autorest-as-a-service"; -import { parseAutorestArgs } from "./args"; -import { resetAutorest, showAvailableCoreVersions, showInstalledExtensions } from "./commands"; import { clearTempData } from "./actions"; -import { loadConfig, resolveCoreVersion } from "./utils"; +import { parseAutorestArgs } from "./args"; +import { newCorePackage, ensureAutorestHome, runCoreWithRequire, runCoreOutOfProc } from "./autorest-as-a-service"; +import { resetAutorest, showAvailableCoreVersions, showInstalledExtensions } from "./commands"; import { VERSION } from "./constants"; +import { loadConfig, resolveCoreVersion } from "./utils"; const launchCore = isDebuggerEnabled ? runCoreWithRequire : runCoreOutOfProc; diff --git a/packages/apps/autorest/src/autorest-as-a-service.ts b/packages/apps/autorest/src/autorest-as-a-service.ts index 1f396465b..d4365f249 100644 --- a/packages/apps/autorest/src/autorest-as-a-service.ts +++ b/packages/apps/autorest/src/autorest-as-a-service.ts @@ -1,22 +1,21 @@ /* eslint-disable no-process-exit */ /* eslint-disable no-console */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ +import { spawn } from "child_process"; import { lookup } from "dns"; -import { Extension, ExtensionManager, Package } from "@azure-tools/extension"; -import { homedir } from "os"; -import { join } from "path"; +import { mkdtempSync, rmdirSync } from "fs"; +import { homedir, tmpdir } from "os"; -import { Exception } from "@azure-tools/tasks"; +import { join } from "path"; +import { AutorestConfiguration } from "@autorest/configuration"; +import { isFile, mkdir, isDirectory } from "@azure-tools/async-io"; +import { Extension, ExtensionManager, Package } from "@azure-tools/extension"; + +import { Exception, When } from "@azure-tools/tasks"; import * as semver from "semver"; -import { isFile, mkdir, isDirectory } from "@azure-tools/async-io"; -import { When } from "@azure-tools/tasks"; -import { mkdtempSync, rmdirSync } from "fs"; -import { tmpdir } from "os"; -import { spawn } from "child_process"; import { AutorestArgs } from "./args"; import { VERSION } from "./constants"; -import { AutorestConfiguration } from "@autorest/configuration"; import { parseMemory } from "./utils"; const inWebpack = typeof __webpack_require__ === "function"; diff --git a/packages/apps/autorest/src/commands/reset.ts b/packages/apps/autorest/src/commands/reset.ts index 32d99c05e..efcbca51d 100644 --- a/packages/apps/autorest/src/commands/reset.ts +++ b/packages/apps/autorest/src/commands/reset.ts @@ -1,7 +1,7 @@ /* eslint-disable no-console */ +import { color } from "@autorest/common"; import { AutorestArgs } from "../args"; import { extensionManager, rootFolder } from "../autorest-as-a-service"; -import { color } from "@autorest/common"; /** * Reset autorest, this will: diff --git a/packages/apps/autorest/src/constants.ts b/packages/apps/autorest/src/constants.ts index 3681c835a..6a714c9f0 100644 --- a/packages/apps/autorest/src/constants.ts +++ b/packages/apps/autorest/src/constants.ts @@ -2,8 +2,8 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as path from "path"; import { existsSync } from "fs"; +import * as path from "path"; const resolveAppRoot = () => { let current = path.resolve(__dirname); diff --git a/packages/apps/autorest/src/exports.ts b/packages/apps/autorest/src/exports.ts index 8d074c993..7792df1de 100644 --- a/packages/apps/autorest/src/exports.ts +++ b/packages/apps/autorest/src/exports.ts @@ -8,13 +8,13 @@ /// // everything else. -import { runCoreWithRequire, resolveEntrypoint, ensureAutorestHome, selectVersion } from "./autorest-as-a-service"; import { resolve } from "path"; +import { GenerationResults, IFileSystem, AutoRest as IAutoRest } from "autorest-core"; import { LanguageClient } from "vscode-languageclient"; // exports the public AutoRest definitions -import { GenerationResults, IFileSystem, AutoRest as IAutoRest } from "autorest-core"; +import { runCoreWithRequire, resolveEntrypoint, ensureAutorestHome, selectVersion } from "./autorest-as-a-service"; export { Message, Artifact, GenerationResults, IFileSystem } from "autorest-core"; // This is needed currently in autorest-as-service when starting @autorest/core out of proc for @autorest/core version older than 3.6.0 diff --git a/packages/apps/autorest/src/utils.ts b/packages/apps/autorest/src/utils.ts index de37c0fe9..eedba9723 100644 --- a/packages/apps/autorest/src/utils.ts +++ b/packages/apps/autorest/src/utils.ts @@ -1,14 +1,14 @@ -import { AutorestArgs } from "./args"; -import { AutorestConfiguration, AutorestNormalizedConfiguration, ConfigurationLoader } from "@autorest/configuration"; -import { AutorestSyncLogger, ConsoleLoggerSink } from "@autorest/common"; -import { createFileOrFolderUri, createFolderUri, resolveUri } from "@azure-tools/uri"; -import { AppRoot } from "./constants"; -import { extensionManager, networkEnabled, selectVersion } from "./autorest-as-a-service"; -import chalk from "chalk"; -import { checkForAutoRestUpdate } from "./actions"; -import { isFile } from "@azure-tools/async-io"; import { dirname, join, resolve } from "path"; +import { AutorestSyncLogger, ConsoleLoggerSink } from "@autorest/common"; +import { AutorestConfiguration, AutorestNormalizedConfiguration, ConfigurationLoader } from "@autorest/configuration"; +import { isFile } from "@azure-tools/async-io"; +import { createFileOrFolderUri, createFolderUri, resolveUri } from "@azure-tools/uri"; +import chalk from "chalk"; import untildify from "untildify"; +import { checkForAutoRestUpdate } from "./actions"; +import { AutorestArgs } from "./args"; +import { extensionManager, networkEnabled, selectVersion } from "./autorest-as-a-service"; +import { AppRoot } from "./constants"; const inWebpack = typeof __webpack_require__ === "function"; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion diff --git a/packages/extensions/cadl/package.json b/packages/extensions/cadl/package.json index c87d9f328..2d6858c8f 100644 --- a/packages/extensions/cadl/package.json +++ b/packages/extensions/cadl/package.json @@ -49,6 +49,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "lodash": "~4.17.20", diff --git a/packages/extensions/cadl/src/cadl-compiler-plugin.ts b/packages/extensions/cadl/src/cadl-compiler-plugin.ts index 9e576b331..a19d1056a 100644 --- a/packages/extensions/cadl/src/cadl-compiler-plugin.ts +++ b/packages/extensions/cadl/src/cadl-compiler-plugin.ts @@ -1,5 +1,5 @@ -import { Channel, Host } from "@autorest/extension-base"; import { fileURLToPath } from "url"; +import { Channel, Host } from "@autorest/extension-base"; import { compileAdl } from "./cadl-compiler.js"; export async function setupAdlCompilerPlugin(host: Host) { diff --git a/packages/extensions/cadl/src/cadl-compiler.ts b/packages/extensions/cadl/src/cadl-compiler.ts index 725f507b0..14a6e66af 100644 --- a/packages/extensions/cadl/src/cadl-compiler.ts +++ b/packages/extensions/cadl/src/cadl-compiler.ts @@ -1,7 +1,7 @@ -import { CompilerHost, createProgram, Diagnostic, createSourceFile } from "@cadl-lang/compiler"; import { readFile, realpath, stat } from "fs/promises"; import { join, resolve } from "path"; import { fileURLToPath, pathToFileURL } from "url"; +import { CompilerHost, createProgram, Diagnostic, createSourceFile } from "@cadl-lang/compiler"; export function createAdlHost(writeFile: (path: string, content: string) => Promise): CompilerHost { return { diff --git a/packages/extensions/core/package.json b/packages/extensions/core/package.json index d3492eaf9..b1de33c0d 100644 --- a/packages/extensions/core/package.json +++ b/packages/extensions/core/package.json @@ -78,6 +78,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "jsonpath": "1.0.0", diff --git a/packages/extensions/core/src/app.ts b/packages/extensions/core/src/app.ts index 669fed654..d3c639377 100644 --- a/packages/extensions/core/src/app.ts +++ b/packages/extensions/core/src/app.ts @@ -4,7 +4,8 @@ *--------------------------------------------------------------------------------------------*/ /* eslint-disable no-console */ import "source-map-support/register"; -import { omit } from "lodash"; +import { EventEmitter } from "events"; +import { resolve as currentDirectory } from "path"; import { configureLibrariesLogger, color, @@ -12,8 +13,9 @@ import { FilterLogger, AutorestLogger, AutorestSyncLogger, + Exception, } from "@autorest/common"; -import { EventEmitter } from "events"; + import { AutorestCliArgs, parseAutorestCliArgs } from "@autorest/configuration"; EventEmitter.defaultMaxListeners = 100; process.env["ELECTRON_RUN_AS_NODE"] = "1"; @@ -23,7 +25,6 @@ delete process.env["ELECTRON_NO_ATTACH_CONSOLE"]; // the console app starts for real here. import { EnhancedFileSystem, RealFileSystem } from "@azure-tools/datastore"; -import { parseYAML } from "@azure-tools/yaml"; import { clearFolder, createFolderUri, @@ -33,13 +34,13 @@ import { writeBinary, writeString, } from "@azure-tools/uri"; -import { resolve as currentDirectory } from "path"; +import { parseYAML } from "@azure-tools/yaml"; +import { omit } from "lodash"; +import { ArtifactWriter } from "./artifact-writer"; import { Help } from "./help"; import { Artifact } from "./lib/artifact"; import { AutoRest, IsOpenApiDocument, Shutdown } from "./lib/autorest-core"; -import { Exception } from "@autorest/common"; import { VERSION } from "./lib/constants"; -import { ArtifactWriter } from "./artifact-writer"; import { getLogLevel } from "./lib/context"; let verbose = false; diff --git a/packages/extensions/core/src/artifact-writer.ts b/packages/extensions/core/src/artifact-writer.ts index d44d0d503..09a91c0be 100644 --- a/packages/extensions/core/src/artifact-writer.ts +++ b/packages/extensions/core/src/artifact-writer.ts @@ -1,6 +1,6 @@ -import { Artifact } from "./lib/artifact"; -import { writeBinary, writeString } from "@azure-tools/uri"; import { AutorestConfiguration } from "@autorest/configuration"; +import { writeBinary, writeString } from "@azure-tools/uri"; +import { Artifact } from "./lib/artifact"; export class ArtifactWriter { private tasks: Promise[] = []; diff --git a/packages/extensions/core/src/lib/autorest-core.ts b/packages/extensions/core/src/lib/autorest-core.ts index 3c92f035a..56924d313 100644 --- a/packages/extensions/core/src/lib/autorest-core.ts +++ b/packages/extensions/core/src/lib/autorest-core.ts @@ -2,26 +2,24 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ - -import { AutorestContextLoader, AutorestContext, MessageEmitter } from "./context"; -import { EventEmitter, IEvent } from "./events"; +import { homedir } from "os"; import { AutorestLoggingSession, ConsoleLogger, Exception, - LogInfo, LoggerSink, AutorestLoggerSourceEnhancer, AutorestAsyncLogger, AutorestLogger, } from "@autorest/common"; +import { isConfigurationDocument } from "@autorest/configuration"; import { IFileSystem, RealFileSystem } from "@azure-tools/datastore"; +import { Artifact } from "./artifact"; +import { AutorestContextLoader, AutorestContext, MessageEmitter } from "./context"; +import { DocumentType } from "./document-type"; +import { EventEmitter, IEvent } from "./events"; import { runPipeline } from "./pipeline/pipeline"; export { AutorestContext } from "./context"; -import { isConfigurationDocument } from "@autorest/configuration"; -import { homedir } from "os"; -import { Artifact } from "./artifact"; -import { DocumentType } from "./document-type"; import { StatsCollector } from "./stats"; function IsIterable(target: any) { diff --git a/packages/extensions/core/src/lib/constants.ts b/packages/extensions/core/src/lib/constants.ts index 49824c0ab..0256dfdc5 100644 --- a/packages/extensions/core/src/lib/constants.ts +++ b/packages/extensions/core/src/lib/constants.ts @@ -2,8 +2,8 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as path from "path"; import { existsSync } from "fs"; +import * as path from "path"; const resolveAppRoot = () => { let current = path.resolve(__dirname); diff --git a/packages/extensions/core/src/lib/context/autorest-context-loader.ts b/packages/extensions/core/src/lib/context/autorest-context-loader.ts index 003884291..89a697c35 100644 --- a/packages/extensions/core/src/lib/context/autorest-context-loader.ts +++ b/packages/extensions/core/src/lib/context/autorest-context-loader.ts @@ -3,10 +3,9 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { CachingFileSystem, IFileSystem, LazyPromise, RealFileSystem } from "@azure-tools/datastore"; -import { Extension, ExtensionManager } from "@azure-tools/extension"; +import { homedir } from "os"; import { join } from "path"; -import { AutoRestExtension } from "../pipeline/plugin-endpoint"; +import { FilterLogger, AutorestLoggingSession, AutorestLogger } from "@autorest/common"; import { AutorestConfiguration, AutorestRawConfiguration, @@ -15,13 +14,14 @@ import { mergeConfigurations, ResolvedExtension, } from "@autorest/configuration"; -import { AutorestContext, getLogLevel } from "./autorest-context"; -import { MessageEmitter } from "./message-emitter"; -import { FilterLogger, AutorestLoggingSession, AutorestLogger } from "@autorest/common"; +import { CachingFileSystem, IFileSystem, LazyPromise, RealFileSystem } from "@azure-tools/datastore"; +import { Extension, ExtensionManager } from "@azure-tools/extension"; import { createFileOrFolderUri, createFolderUri, resolveUri } from "@azure-tools/uri"; import { AppRoot } from "../constants"; -import { homedir } from "os"; +import { AutoRestExtension } from "../pipeline/plugin-endpoint"; import { StatsCollector } from "../stats"; +import { AutorestContext, getLogLevel } from "./autorest-context"; +import { MessageEmitter } from "./message-emitter"; const inWebpack = typeof __webpack_require__ === "function"; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion diff --git a/packages/extensions/core/src/lib/context/autorest-context.ts b/packages/extensions/core/src/lib/context/autorest-context.ts index 46d4512c2..2d0f025a3 100644 --- a/packages/extensions/core/src/lib/context/autorest-context.ts +++ b/packages/extensions/core/src/lib/context/autorest-context.ts @@ -1,16 +1,4 @@ -import { DataStore, CachingFileSystem } from "@azure-tools/datastore"; import { basename, dirname } from "path"; -import { CancellationToken, CancellationTokenSource } from "vscode-jsonrpc"; -import { Artifact } from "../artifact"; -import { - AutorestNormalizedConfiguration, - getNestedConfiguration, - ResolvedDirective, - resolveDirectives, -} from "@autorest/configuration"; -import { MessageEmitter } from "./message-emitter"; -import { IEvent } from "../events"; -import { AutorestConfiguration, arrayOf, extendAutorestConfiguration } from "@autorest/configuration"; import { AutorestError, FilterLogger, @@ -21,10 +9,25 @@ import { LogSuppression, IAutorestLogger, } from "@autorest/common"; -import { VERSION } from "../constants"; -import { StatsCollector } from "../stats"; -import { PipelinePluginDefinition } from "../pipeline/plugin-loader"; +import { + AutorestNormalizedConfiguration, + getNestedConfiguration, + ResolvedDirective, + resolveDirectives, + AutorestConfiguration, + arrayOf, + extendAutorestConfiguration, +} from "@autorest/configuration"; + +import { DataStore, CachingFileSystem } from "@azure-tools/datastore"; import { cloneDeep } from "lodash"; +import { CancellationToken, CancellationTokenSource } from "vscode-jsonrpc"; +import { Artifact } from "../artifact"; +import { VERSION } from "../constants"; +import { IEvent } from "../events"; +import { PipelinePluginDefinition } from "../pipeline/plugin-loader"; +import { StatsCollector } from "../stats"; +import { MessageEmitter } from "./message-emitter"; export class AutorestContext implements IAutorestLogger { public config: AutorestConfiguration; diff --git a/packages/extensions/core/src/lib/context/message-emitter.ts b/packages/extensions/core/src/lib/context/message-emitter.ts index fca5e0f62..ea6209542 100644 --- a/packages/extensions/core/src/lib/context/message-emitter.ts +++ b/packages/extensions/core/src/lib/context/message-emitter.ts @@ -1,7 +1,7 @@ +import { DataStore } from "@azure-tools/datastore"; +import { CancellationToken, CancellationTokenSource } from "vscode-jsonrpc"; import { Artifact } from "../artifact"; import { EventEmitter, IEvent } from "../events"; -import { CancellationToken, CancellationTokenSource } from "vscode-jsonrpc"; -import { DataStore } from "@azure-tools/datastore"; export class MessageEmitter extends EventEmitter { /** diff --git a/packages/extensions/core/src/lib/message.ts b/packages/extensions/core/src/lib/message.ts index 9a2888ace..544fcaa52 100644 --- a/packages/extensions/core/src/lib/message.ts +++ b/packages/extensions/core/src/lib/message.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Position, RawSourceMap } from "source-map"; import { EnhancedPosition, Mapping } from "@azure-tools/datastore"; +import { Position, RawSourceMap } from "source-map"; import { Artifact } from "./artifact"; /** diff --git a/packages/extensions/core/src/lib/pipeline/pipeline-cache.ts b/packages/extensions/core/src/lib/pipeline/pipeline-cache.ts index 25769d654..3ca7eba41 100644 --- a/packages/extensions/core/src/lib/pipeline/pipeline-cache.ts +++ b/packages/extensions/core/src/lib/pipeline/pipeline-cache.ts @@ -1,9 +1,9 @@ -import { QuickDataSource, DataSource, DataHandle, DataSink } from "@azure-tools/datastore"; - +import { createHash } from "crypto"; import { tmpdir } from "os"; + import { join } from "path"; import { isDirectory, readdir, mkdir, writeFile, readFile } from "@azure-tools/async-io"; -import { createHash } from "crypto"; +import { QuickDataSource, DataSource, DataHandle, DataSink } from "@azure-tools/datastore"; const md5 = (content: any) => createHash("md5").update(JSON.stringify(content)).digest("hex"); diff --git a/packages/extensions/core/src/lib/pipeline/pipeline.ts b/packages/extensions/core/src/lib/pipeline/pipeline.ts index f4c5415c6..6648a7a8b 100644 --- a/packages/extensions/core/src/lib/pipeline/pipeline.ts +++ b/packages/extensions/core/src/lib/pipeline/pipeline.ts @@ -5,6 +5,8 @@ /* eslint-disable @typescript-eslint/no-use-before-define */ +import { createHash } from "crypto"; +import { promisify } from "util"; import { DataHandle, DataSource, @@ -16,15 +18,13 @@ import { PipeState, mergePipeStates, } from "@azure-tools/datastore"; +import { mapValues, omitBy } from "lodash"; import { AutorestContext } from "../context"; import { OutstandingTaskAwaiter } from "../outstanding-task-awaiter"; -import { createArtifactEmitterPlugin } from "../plugins/emitter"; -import { createHash } from "crypto"; -import { isCached, readCache, writeCache } from "./pipeline-cache"; import { CORE_PLUGIN_MAP } from "../plugins"; +import { createArtifactEmitterPlugin } from "../plugins/emitter"; +import { isCached, readCache, writeCache } from "./pipeline-cache"; import { loadPlugins, PipelinePluginDefinition } from "./plugin-loader"; -import { mapValues, omitBy } from "lodash"; -import { promisify } from "util"; const safeEval = createSandbox(); const setImmediatePromise = promisify(setImmediate); diff --git a/packages/extensions/core/src/lib/pipeline/plugin-api.ts b/packages/extensions/core/src/lib/pipeline/plugin-api.ts index 339db76ae..f383e6e19 100644 --- a/packages/extensions/core/src/lib/pipeline/plugin-api.ts +++ b/packages/extensions/core/src/lib/pipeline/plugin-api.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { RequestType0, RequestType2 } from "vscode-jsonrpc"; -import { NotificationType2, NotificationType4 } from "vscode-jsonrpc"; -import { Mapping, RawSourceMap } from "source-map"; -import { Message } from "../message"; import { PathPosition } from "@azure-tools/datastore"; +import { Mapping, RawSourceMap } from "source-map"; +import { RequestType0, RequestType2, NotificationType2, NotificationType4 } from "vscode-jsonrpc"; + +import { Message } from "../message"; export namespace IAutoRestPluginTargetTypes { export const GetPluginNames = new RequestType0, Error, void>("GetPluginNames"); diff --git a/packages/extensions/core/src/lib/pipeline/plugin-endpoint.ts b/packages/extensions/core/src/lib/pipeline/plugin-endpoint.ts index b8fef881e..f491b2e48 100644 --- a/packages/extensions/core/src/lib/pipeline/plugin-endpoint.ts +++ b/packages/extensions/core/src/lib/pipeline/plugin-endpoint.ts @@ -3,16 +3,16 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { ChildProcess } from "child_process"; +import { Readable, Writable } from "stream"; +import { Exception } from "@autorest/common"; import { DataHandle, DataSink, DataSource, LazyPromise, Mapping, PathPosition } from "@azure-tools/datastore"; import { ensureIsFolderUri } from "@azure-tools/uri"; -import { ChildProcess } from "child_process"; import { RawSourceMap } from "source-map"; -import { Readable, Writable } from "stream"; import { CancellationToken, createMessageConnection } from "vscode-jsonrpc"; import { Artifact } from "../artifact"; import { AutorestContext } from "../context"; import { EventEmitter } from "../events"; -import { Exception } from "@autorest/common"; import { ArtifactMessage, Channel, Message } from "../message"; import { IAutoRestPluginInitiator, IAutoRestPluginInitiatorTypes, IAutoRestPluginTargetTypes } from "./plugin-api"; diff --git a/packages/extensions/core/src/lib/plugins/allof-cleaner.ts b/packages/extensions/core/src/lib/plugins/allof-cleaner.ts index f60b0817d..dd1d4cdae 100644 --- a/packages/extensions/core/src/lib/plugins/allof-cleaner.ts +++ b/packages/extensions/core/src/lib/plugins/allof-cleaner.ts @@ -1,9 +1,9 @@ +import { isDefined } from "@autorest/common"; import { DataHandle, DataSink, DataSource, QuickDataSource, Source } from "@azure-tools/datastore"; import { Model, isReference, Schema } from "@azure-tools/openapi"; +import { cloneDeep } from "lodash"; import { AutorestContext } from "../context"; import { PipelinePlugin } from "../pipeline/common"; -import { isDefined } from "@autorest/common"; -import { cloneDeep } from "lodash"; async function cleanAllOfs(model: Model) { const output = cloneDeep(model); diff --git a/packages/extensions/core/src/lib/plugins/command.ts b/packages/extensions/core/src/lib/plugins/command.ts index 6688a6ccc..1e3630c54 100644 --- a/packages/extensions/core/src/lib/plugins/command.ts +++ b/packages/extensions/core/src/lib/plugins/command.ts @@ -1,8 +1,8 @@ -import { PipelinePlugin } from "../pipeline/common"; -import { AutorestContext } from "../context"; -import { DataSource, DataSink, DataHandle, QuickDataSource } from "@azure-tools/datastore"; import { execute, cmdlineToArray } from "@azure-tools/codegen"; +import { DataSource, DataSink, DataHandle, QuickDataSource } from "@azure-tools/datastore"; import { FileUriToPath } from "@azure-tools/uri"; +import { AutorestContext } from "../context"; +import { PipelinePlugin } from "../pipeline/common"; async function command(context: AutorestContext, input: DataSource, sink: DataSink) { const c = context.config.raw.run; diff --git a/packages/extensions/core/src/lib/plugins/component-modifier.ts b/packages/extensions/core/src/lib/plugins/component-modifier.ts index 7df36e82e..bbf083d8e 100644 --- a/packages/extensions/core/src/lib/plugins/component-modifier.ts +++ b/packages/extensions/core/src/lib/plugins/component-modifier.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { mergeOverwriteOrAppend } from "@autorest/common"; -import { createPerFilePlugin, PipelinePlugin } from "../pipeline/common"; import { cloneDeep } from "lodash"; +import { createPerFilePlugin, PipelinePlugin } from "../pipeline/common"; function decorateSpecialProperties(o: any): void { if (o["implementation"]) { diff --git a/packages/extensions/core/src/lib/plugins/components-cleaner.ts b/packages/extensions/core/src/lib/plugins/components-cleaner.ts index f64c221b9..f968f92e1 100644 --- a/packages/extensions/core/src/lib/plugins/components-cleaner.ts +++ b/packages/extensions/core/src/lib/plugins/components-cleaner.ts @@ -14,9 +14,9 @@ import { Transformer, } from "@azure-tools/datastore"; import * as oai from "@azure-tools/openapi"; +import oai3 from "@azure-tools/openapi"; import { AutorestContext } from "../context"; import { PipelinePlugin } from "../pipeline/common"; -import oai3 from "@azure-tools/openapi"; /** * components-to-keep are the ones that: diff --git a/packages/extensions/core/src/lib/plugins/conversion.ts b/packages/extensions/core/src/lib/plugins/conversion.ts index f0430f620..724e1d1d7 100644 --- a/packages/extensions/core/src/lib/plugins/conversion.ts +++ b/packages/extensions/core/src/lib/plugins/conversion.ts @@ -1,9 +1,9 @@ +import { AutorestDiagnostic } from "@autorest/common"; import { DataHandle, IFileSystem, QuickDataSource } from "@azure-tools/datastore"; -import { PipelinePlugin } from "../pipeline/common"; +import { parseJsonPointer } from "@azure-tools/json"; import { ConverterDiagnostic, ConverterLogger, convertOai2ToOai3Files } from "@azure-tools/oai2-to-oai3"; import { cloneDeep } from "lodash"; -import { AutorestDiagnostic } from "@autorest/common"; -import { parseJsonPointer } from "@azure-tools/json"; +import { PipelinePlugin } from "../pipeline/common"; /* @internal */ export function createSwaggerToOpenApi3Plugin(fileSystem?: IFileSystem): PipelinePlugin { diff --git a/packages/extensions/core/src/lib/plugins/emitter.ts b/packages/extensions/core/src/lib/plugins/emitter.ts index cc45bcda8..dff03b6b8 100644 --- a/packages/extensions/core/src/lib/plugins/emitter.ts +++ b/packages/extensions/core/src/lib/plugins/emitter.ts @@ -1,6 +1,6 @@ import { DataHandle, DataSource, QuickDataSource, createSandbox } from "@azure-tools/datastore"; -import { deepNormalize, Stringify } from "@azure-tools/yaml"; import { resolveUri } from "@azure-tools/uri"; +import { deepNormalize, Stringify } from "@azure-tools/yaml"; import { AutorestContext } from "../context"; import { Channel } from "../message"; import { PipelinePlugin } from "../pipeline/common"; diff --git a/packages/extensions/core/src/lib/plugins/enum-deduplication/enum-deduplicator.test.ts b/packages/extensions/core/src/lib/plugins/enum-deduplication/enum-deduplicator.test.ts index 3c65b8aef..ad626ff7e 100644 --- a/packages/extensions/core/src/lib/plugins/enum-deduplication/enum-deduplicator.test.ts +++ b/packages/extensions/core/src/lib/plugins/enum-deduplication/enum-deduplicator.test.ts @@ -1,7 +1,7 @@ import { createDataHandle } from "@autorest/test-utils"; -import { EnumDeduplicator } from "./enum-deduplicator"; import * as oai3 from "@azure-tools/openapi"; import { JsonType } from "@azure-tools/openapi"; +import { EnumDeduplicator } from "./enum-deduplicator"; async function runEnumDeduplicator(data: Partial): Promise { const source = createDataHandle(JSON.stringify(data)); diff --git a/packages/extensions/core/src/lib/plugins/enum-deduplication/enum-deduplicator.ts b/packages/extensions/core/src/lib/plugins/enum-deduplication/enum-deduplicator.ts index e5548b628..6770b90fa 100644 --- a/packages/extensions/core/src/lib/plugins/enum-deduplication/enum-deduplicator.ts +++ b/packages/extensions/core/src/lib/plugins/enum-deduplication/enum-deduplicator.ts @@ -1,7 +1,7 @@ -import { AnyObject, Node, TransformerViaPointer, visit } from "@azure-tools/datastore"; -import compareVersions from "compare-versions"; import { toSemver, maximum, pascalCase } from "@azure-tools/codegen"; +import { AnyObject, Node, TransformerViaPointer, visit } from "@azure-tools/datastore"; import * as oai3 from "@azure-tools/openapi"; +import compareVersions from "compare-versions"; import { cloneDeep } from "lodash"; export class EnumDeduplicator extends TransformerViaPointer { diff --git a/packages/extensions/core/src/lib/plugins/external.ts b/packages/extensions/core/src/lib/plugins/external.ts index e0fbcadd5..e2c90a149 100644 --- a/packages/extensions/core/src/lib/plugins/external.ts +++ b/packages/extensions/core/src/lib/plugins/external.ts @@ -1,5 +1,5 @@ -import { DataHandle, QuickDataSource, mergePipeStates } from "@azure-tools/datastore"; import { LogLevel } from "@autorest/common"; +import { DataHandle, QuickDataSource, mergePipeStates } from "@azure-tools/datastore"; import { Channel, Message } from "../message"; import { PipelinePlugin } from "../pipeline/common"; import { AutoRestExtension } from "../pipeline/plugin-endpoint"; diff --git a/packages/extensions/core/src/lib/plugins/identity/identity-plugin.ts b/packages/extensions/core/src/lib/plugins/identity/identity-plugin.ts index fec0adef9..410310da7 100644 --- a/packages/extensions/core/src/lib/plugins/identity/identity-plugin.ts +++ b/packages/extensions/core/src/lib/plugins/identity/identity-plugin.ts @@ -1,5 +1,5 @@ -import { PipelinePlugin } from "../../pipeline/common"; import { QuickDataSource } from "@azure-tools/datastore"; +import { PipelinePlugin } from "../../pipeline/common"; export function createIdentityPlugin(): PipelinePlugin { return async (config, input) => input; diff --git a/packages/extensions/core/src/lib/plugins/identity/normalize-identity-plugin.ts b/packages/extensions/core/src/lib/plugins/identity/normalize-identity-plugin.ts index 338e84870..eeb6b7e64 100644 --- a/packages/extensions/core/src/lib/plugins/identity/normalize-identity-plugin.ts +++ b/packages/extensions/core/src/lib/plugins/identity/normalize-identity-plugin.ts @@ -1,10 +1,10 @@ +import { relative, dirname, basename } from "path"; +import { URL } from "url"; import { DataHandle, DataSink, DataSource, QuickDataSource, visit } from "@azure-tools/datastore"; import { parseJsonRef, stringifyJsonRef, updateJsonRefs } from "@azure-tools/jsonschema"; import { cloneDeep } from "lodash"; import { AutorestContext } from "../../context"; import { PipelinePlugin } from "../../pipeline/common"; -import { URL } from "url"; -import { relative, dirname, basename } from "path"; function resolveRelativeRef(currentFile: string, newRef: string) { return relative(dirname(currentFile), newRef).replace(/\\/g, "/"); diff --git a/packages/extensions/core/src/lib/plugins/identity/reset-identity-plugin.ts b/packages/extensions/core/src/lib/plugins/identity/reset-identity-plugin.ts index 8a9aa4c42..ab72573f2 100644 --- a/packages/extensions/core/src/lib/plugins/identity/reset-identity-plugin.ts +++ b/packages/extensions/core/src/lib/plugins/identity/reset-identity-plugin.ts @@ -1,8 +1,8 @@ -import { PipelinePlugin } from "../../pipeline/common"; -import { AutorestContext } from "../../context"; -import { DataSource, DataSink, QuickDataSource } from "@azure-tools/datastore"; import { identitySourceMapping } from "@autorest/common"; +import { DataSource, DataSink, QuickDataSource } from "@azure-tools/datastore"; import { uniqBy } from "lodash"; +import { AutorestContext } from "../../context"; +import { PipelinePlugin } from "../../pipeline/common"; /** * Add the given suffix to the given filename before the file extension. diff --git a/packages/extensions/core/src/lib/plugins/index.ts b/packages/extensions/core/src/lib/plugins/index.ts index 990a70fbb..02dba3095 100644 --- a/packages/extensions/core/src/lib/plugins/index.ts +++ b/packages/extensions/core/src/lib/plugins/index.ts @@ -1,7 +1,9 @@ +import { QuickDataSource } from "@azure-tools/datastore"; import { createAllOfCleaner } from "./allof-cleaner"; import { createCommandPlugin } from "./command"; import { createComponentKeyRenamerPlugin } from "./component-key-renamer"; +import { createComponentModifierPlugin } from "./component-modifier"; import { createComponentsCleanerPlugin } from "./components-cleaner"; import { createSwaggerToOpenApi3Plugin } from "./conversion"; import { createDeduplicatorPlugin } from "./deduplicator"; @@ -16,8 +18,12 @@ import { } from "./identity"; import { createOpenApiLoaderPlugin, createSwaggerLoaderPlugin } from "./loaders"; import { createMultiApiMergerPlugin } from "./merger"; +import { createCSharpReflectApiVersionPlugin } from "./metadata-generation"; import { createNewComposerPlugin } from "./new-composer"; +import { createOpenAPIStatsCollectorPlugin } from "./openapi-stats-collector"; import { createProfileFilterPlugin } from "./profile-filter"; +import { createOpenApiSchemaValidatorPlugin, createSwaggerSchemaValidatorPlugin } from "./schema-validation"; +import { createSemanticValidationPlugin } from "./semantics-validation"; import { subsetSchemaDeduplicatorPlugin } from "./subset-schemas-deduplicator"; import { createImmediateTransformerPlugin, @@ -27,12 +33,6 @@ import { } from "./transformer"; import { createTreeShakerPlugin } from "./tree-shaker/tree-shaker"; import { createApiVersionParameterHandlerPlugin } from "./version-param-handler"; -import { createOpenApiSchemaValidatorPlugin, createSwaggerSchemaValidatorPlugin } from "./schema-validation"; -import { createOpenAPIStatsCollectorPlugin } from "./openapi-stats-collector"; -import { QuickDataSource } from "@azure-tools/datastore"; -import { createCSharpReflectApiVersionPlugin } from "./metadata-generation"; -import { createComponentModifierPlugin } from "./component-modifier"; -import { createSemanticValidationPlugin } from "./semantics-validation"; export const CORE_PLUGIN_MAP = { help: createHelpPlugin(), diff --git a/packages/extensions/core/src/lib/plugins/loaders/openapi-loader.test.ts b/packages/extensions/core/src/lib/plugins/loaders/openapi-loader.test.ts index d3241bb27..46161f113 100644 --- a/packages/extensions/core/src/lib/plugins/loaders/openapi-loader.test.ts +++ b/packages/extensions/core/src/lib/plugins/loaders/openapi-loader.test.ts @@ -1,8 +1,8 @@ +import { IAutorestLogger } from "@autorest/common"; +import { createMockLogger } from "@autorest/test-utils"; import { DataStore, IFileSystem, RealFileSystem } from "@azure-tools/datastore"; import { createFolderUri, resolveUri } from "@azure-tools/uri"; import { AppRoot } from "../../constants"; -import { createMockLogger } from "@autorest/test-utils"; -import { IAutorestLogger } from "@autorest/common"; import { loadOpenAPIFiles } from "./openapi-loader"; describe("SwaggerLoading", () => { diff --git a/packages/extensions/core/src/lib/plugins/loaders/openapi-loader.ts b/packages/extensions/core/src/lib/plugins/loaders/openapi-loader.ts index 611881a71..f2d2c635a 100644 --- a/packages/extensions/core/src/lib/plugins/loaders/openapi-loader.ts +++ b/packages/extensions/core/src/lib/plugins/loaders/openapi-loader.ts @@ -1,8 +1,8 @@ -import { PipelinePlugin } from "../../pipeline/common"; +import { IAutorestLogger } from "@autorest/common"; import { DataHandle, DataSink, DataSource, QuickDataSource } from "@azure-tools/datastore"; +import { PipelinePlugin } from "../../pipeline/common"; import { crawlReferences } from "../ref-crawling"; import { checkSyntaxFromData } from "./common"; -import { IAutorestLogger } from "@autorest/common"; interface OpenAPI3Spec { openapi?: string; diff --git a/packages/extensions/core/src/lib/plugins/loaders/swagger-loader.test.ts b/packages/extensions/core/src/lib/plugins/loaders/swagger-loader.test.ts index f73deaec3..4fa409c4d 100644 --- a/packages/extensions/core/src/lib/plugins/loaders/swagger-loader.test.ts +++ b/packages/extensions/core/src/lib/plugins/loaders/swagger-loader.test.ts @@ -1,9 +1,9 @@ +import { IAutorestLogger } from "@autorest/common"; +import { createMockLogger } from "@autorest/test-utils"; import { DataStore, IFileSystem, RealFileSystem } from "@azure-tools/datastore"; import { createFolderUri, resolveUri } from "@azure-tools/uri"; -import { loadSwaggerFiles } from "./swagger-loader"; import { AppRoot } from "../../constants"; -import { createMockLogger } from "@autorest/test-utils"; -import { IAutorestLogger } from "@autorest/common"; +import { loadSwaggerFiles } from "./swagger-loader"; describe("SwaggerLoading", () => { let dataStore: DataStore; diff --git a/packages/extensions/core/src/lib/plugins/loaders/swagger-loader.ts b/packages/extensions/core/src/lib/plugins/loaders/swagger-loader.ts index ef51f8bcc..b8db87b09 100644 --- a/packages/extensions/core/src/lib/plugins/loaders/swagger-loader.ts +++ b/packages/extensions/core/src/lib/plugins/loaders/swagger-loader.ts @@ -1,8 +1,8 @@ -import { PipelinePlugin } from "../../pipeline/common"; +import { IAutorestLogger } from "@autorest/common"; import { DataHandle, DataSink, DataSource, QuickDataSource } from "@azure-tools/datastore"; +import { PipelinePlugin } from "../../pipeline/common"; import { crawlReferences } from "../ref-crawling"; import { checkSyntaxFromData } from "./common"; -import { IAutorestLogger } from "@autorest/common"; export async function loadSwaggerFiles( logger: IAutorestLogger, diff --git a/packages/extensions/core/src/lib/plugins/merger.ts b/packages/extensions/core/src/lib/plugins/merger.ts index 48a898b31..cd02d3527 100644 --- a/packages/extensions/core/src/lib/plugins/merger.ts +++ b/packages/extensions/core/src/lib/plugins/merger.ts @@ -1,3 +1,5 @@ +import { URL } from "url"; +import { isDefined } from "@autorest/common"; import { AnyObject, DataHandle, @@ -11,11 +13,9 @@ import { } from "@azure-tools/datastore"; import { walk } from "@azure-tools/json"; import * as oai from "@azure-tools/openapi"; +import { cloneDeep } from "lodash"; import { AutorestContext } from "../context"; import { PipelinePlugin } from "../pipeline/common"; -import { URL } from "url"; -import { isDefined } from "@autorest/common"; -import { cloneDeep } from "lodash"; /** * Takes multiple input OAI3 files and creates one merged one. diff --git a/packages/extensions/core/src/lib/plugins/new-composer.ts b/packages/extensions/core/src/lib/plugins/new-composer.ts index f4720ab6d..91b7202e4 100644 --- a/packages/extensions/core/src/lib/plugins/new-composer.ts +++ b/packages/extensions/core/src/lib/plugins/new-composer.ts @@ -1,3 +1,4 @@ +import { maximum, toSemver } from "@azure-tools/codegen"; import { AnyObject, DataSink, @@ -9,10 +10,9 @@ import { visit, } from "@azure-tools/datastore"; import { areSimilar } from "@azure-tools/object-comparison"; -import { PipelinePlugin } from "../pipeline/common"; -import { maximum, toSemver } from "@azure-tools/codegen"; import compareVersions from "compare-versions"; import { AutorestContext } from "../context"; +import { PipelinePlugin } from "../pipeline/common"; /** * Prepares an OpenAPI document for the generation-2 code generators diff --git a/packages/extensions/core/src/lib/plugins/openapi-stats-collector/openapi-stats-collector.ts b/packages/extensions/core/src/lib/plugins/openapi-stats-collector/openapi-stats-collector.ts index a67b73fc4..b6793967d 100644 --- a/packages/extensions/core/src/lib/plugins/openapi-stats-collector/openapi-stats-collector.ts +++ b/packages/extensions/core/src/lib/plugins/openapi-stats-collector/openapi-stats-collector.ts @@ -1,7 +1,7 @@ import { DataSource } from "@azure-tools/datastore"; +import * as oai3 from "@azure-tools/openapi"; import { AutorestContext } from "../../context"; import { PipelinePlugin } from "../../pipeline/common"; -import * as oai3 from "@azure-tools/openapi"; export async function collectOpenAPIStats(context: AutorestContext, dataSource: DataSource) { const inputs = await dataSource.enum(); diff --git a/packages/extensions/core/src/lib/plugins/schema-validation/schema-validation-plugins.ts b/packages/extensions/core/src/lib/plugins/schema-validation/schema-validation-plugins.ts index c51e1f962..f03ac5785 100644 --- a/packages/extensions/core/src/lib/plugins/schema-validation/schema-validation-plugins.ts +++ b/packages/extensions/core/src/lib/plugins/schema-validation/schema-validation-plugins.ts @@ -2,14 +2,14 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { DataHandle } from "@azure-tools/datastore"; import { OperationAbortedException } from "@autorest/common"; +import { DataHandle } from "@azure-tools/datastore"; +import { AutorestContext } from "../../context"; import { Channel } from "../../message"; import { createPerFilePlugin, PipelinePlugin } from "../../pipeline/common"; -import { AutorestContext } from "../../context"; -import { SwaggerSchemaValidator } from "./swagger-schema-validator"; -import { OpenApi3SchemaValidator } from "./openapi3-schema-validator"; import { ValidationError } from "./json-schema-validator"; +import { OpenApi3SchemaValidator } from "./openapi3-schema-validator"; +import { SwaggerSchemaValidator } from "./swagger-schema-validator"; export const SCHEMA_VIOLATION_ERROR_CODE = "schema_violation"; diff --git a/packages/extensions/core/src/lib/plugins/schema-validation/swagger-schema-validator.test.ts b/packages/extensions/core/src/lib/plugins/schema-validation/swagger-schema-validator.test.ts index d593fabb8..9a9f46855 100644 --- a/packages/extensions/core/src/lib/plugins/schema-validation/swagger-schema-validator.test.ts +++ b/packages/extensions/core/src/lib/plugins/schema-validation/swagger-schema-validator.test.ts @@ -1,7 +1,7 @@ +import { createDataHandle } from "@autorest/test-utils"; import { DataHandle } from "@azure-tools/datastore"; import { omit } from "lodash"; import { SwaggerSchemaValidator } from "./swagger-schema-validator"; -import { createDataHandle } from "@autorest/test-utils"; const baseSwaggerSpec = { swagger: "2.0", info: { diff --git a/packages/extensions/core/src/lib/plugins/semantics-validation/semantics-validation-plugin.ts b/packages/extensions/core/src/lib/plugins/semantics-validation/semantics-validation-plugin.ts index f451286a6..f5bcbb64e 100644 --- a/packages/extensions/core/src/lib/plugins/semantics-validation/semantics-validation-plugin.ts +++ b/packages/extensions/core/src/lib/plugins/semantics-validation/semantics-validation-plugin.ts @@ -1,11 +1,11 @@ -import { PipelinePlugin } from "../../pipeline/common"; -import oai3, { dereference, Refable } from "@azure-tools/openapi"; -import { validateOpenAPISemantics } from "./semantics-validation"; -import { DataHandle } from "@azure-tools/datastore"; -import { AutorestContext } from "../../context"; import util from "util"; -import { SemanticError } from "./types"; +import { DataHandle } from "@azure-tools/datastore"; import { JsonRef, parseJsonRef, stringifyJsonRef } from "@azure-tools/jsonschema"; +import oai3, { dereference, Refable } from "@azure-tools/openapi"; +import { AutorestContext } from "../../context"; +import { PipelinePlugin } from "../../pipeline/common"; +import { validateOpenAPISemantics } from "./semantics-validation"; +import { SemanticError } from "./types"; export function createSemanticValidationPlugin(): PipelinePlugin { return async (context, input, sink) => { diff --git a/packages/extensions/core/src/lib/plugins/semantics-validation/validators/paths-validator.ts b/packages/extensions/core/src/lib/plugins/semantics-validation/validators/paths-validator.ts index 1368ff25a..5be740c18 100644 --- a/packages/extensions/core/src/lib/plugins/semantics-validation/validators/paths-validator.ts +++ b/packages/extensions/core/src/lib/plugins/semantics-validation/validators/paths-validator.ts @@ -1,5 +1,5 @@ -import { ResolveReferenceFn, SemanticError, SemanticErrorCodes } from "../types"; import oai3, { ParameterLocation, Refable } from "@azure-tools/openapi"; +import { ResolveReferenceFn, SemanticError, SemanticErrorCodes } from "../types"; import { createReferenceResolver } from "../utils"; export const PATH_TEMPLATES_REGEX = /\{(.*?)\}/g; diff --git a/packages/extensions/core/src/lib/plugins/subset-schemas-deduplicator.ts b/packages/extensions/core/src/lib/plugins/subset-schemas-deduplicator.ts index 66e969eb7..4a5624408 100644 --- a/packages/extensions/core/src/lib/plugins/subset-schemas-deduplicator.ts +++ b/packages/extensions/core/src/lib/plugins/subset-schemas-deduplicator.ts @@ -1,3 +1,4 @@ +import { maximum, gt, lt } from "@azure-tools/codegen"; import { AnyObject, DataHandle, @@ -13,7 +14,6 @@ import { areSimilar } from "@azure-tools/object-comparison"; import * as oai from "@azure-tools/openapi"; import { AutorestContext } from "../context"; import { PipelinePlugin } from "../pipeline/common"; -import { maximum, gt, lt } from "@azure-tools/codegen"; /* eslint-disable @typescript-eslint/no-use-before-define */ diff --git a/packages/extensions/core/src/lib/plugins/transformer/manipulation.ts b/packages/extensions/core/src/lib/plugins/transformer/manipulation.ts index 7f8884569..7e59de5bd 100644 --- a/packages/extensions/core/src/lib/plugins/transformer/manipulation.ts +++ b/packages/extensions/core/src/lib/plugins/transformer/manipulation.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { ResolvedDirective, resolveDirectives } from "@autorest/configuration"; import { DataHandle, DataSink, nodes } from "@azure-tools/datastore"; import { YieldCPU } from "@azure-tools/tasks"; +import { scrypt } from "node:crypto"; import { AutorestContext } from "../../autorest-core"; import { Channel, Message, SourceLocation } from "../../message"; -import { manipulateObject } from "./object-manipulator"; import { evalDirectiveTest, evalDirectiveTransform } from "./eval"; -import { ResolvedDirective, resolveDirectives } from "@autorest/configuration"; -import { scrypt } from "node:crypto"; +import { manipulateObject } from "./object-manipulator"; export class Manipulator { private transformations: ResolvedDirective[]; diff --git a/packages/extensions/core/src/lib/plugins/transformer/object-manipulator.test.ts b/packages/extensions/core/src/lib/plugins/transformer/object-manipulator.test.ts index 7c6c4aee1..977d24394 100644 --- a/packages/extensions/core/src/lib/plugins/transformer/object-manipulator.test.ts +++ b/packages/extensions/core/src/lib/plugins/transformer/object-manipulator.test.ts @@ -2,9 +2,8 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { DataStore } from "@azure-tools/datastore"; +import { DataStore, createSandbox } from "@azure-tools/datastore"; import { manipulateObject } from "./object-manipulator"; -import { createSandbox } from "@azure-tools/datastore"; const safeEval = createSandbox(); diff --git a/packages/extensions/core/src/lib/plugins/transformer/object-manipulator.ts b/packages/extensions/core/src/lib/plugins/transformer/object-manipulator.ts index ec4625a98..a9c212b62 100644 --- a/packages/extensions/core/src/lib/plugins/transformer/object-manipulator.ts +++ b/packages/extensions/core/src/lib/plugins/transformer/object-manipulator.ts @@ -3,6 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { inspect } from "util"; +import { identitySourceMapping } from "@autorest/common"; import { DataHandle, DataSink, IsPrefix, JsonPath, nodes, PathPosition } from "@azure-tools/datastore"; import { stringifyYamlAst, @@ -13,10 +15,8 @@ import { getYamlNodeByPath, replaceYamlAstNode, } from "@azure-tools/yaml"; -import { AutorestContext } from "../../autorest-core"; -import { identitySourceMapping } from "@autorest/common"; -import { inspect } from "util"; import { cloneDeep } from "lodash"; +import { AutorestContext } from "../../autorest-core"; export async function manipulateObject( src: DataHandle, diff --git a/packages/extensions/core/src/lib/plugins/transformer/transformer.ts b/packages/extensions/core/src/lib/plugins/transformer/transformer.ts index 8a392b169..b9ecda29b 100644 --- a/packages/extensions/core/src/lib/plugins/transformer/transformer.ts +++ b/packages/extensions/core/src/lib/plugins/transformer/transformer.ts @@ -1,8 +1,8 @@ import { QuickDataSource, DataHandle, AnyObject, selectNodes } from "@azure-tools/datastore"; -import { createPerFilePlugin, PipelinePlugin } from "../../pipeline/common"; -import { Manipulator } from "./manipulation"; import { Channel } from "../../message"; +import { createPerFilePlugin, PipelinePlugin } from "../../pipeline/common"; import { evalDirectiveTransform } from "./eval"; +import { Manipulator } from "./manipulation"; /* @internal */ export function createGraphTransformerPlugin(): PipelinePlugin { diff --git a/packages/extensions/core/src/lib/plugins/tree-shaker/tree-shaker.ts b/packages/extensions/core/src/lib/plugins/tree-shaker/tree-shaker.ts index 2979b442a..64db19780 100644 --- a/packages/extensions/core/src/lib/plugins/tree-shaker/tree-shaker.ts +++ b/packages/extensions/core/src/lib/plugins/tree-shaker/tree-shaker.ts @@ -1,4 +1,5 @@ /* eslint-disable no-useless-escape */ +import { createHash } from "crypto"; import { AnyObject, DataHandle, @@ -10,13 +11,12 @@ import { JsonPath, Source, } from "@azure-tools/datastore"; +import { parseJsonPointer } from "@azure-tools/json"; +import { includeXDashProperties } from "@azure-tools/openapi"; +import { partition } from "lodash"; import { AutorestContext } from "../../context"; import { PipelinePlugin } from "../../pipeline/common"; -import { createHash } from "crypto"; import { SchemaStats } from "../../stats"; -import { includeXDashProperties } from "@azure-tools/openapi"; -import { parseJsonPointer } from "@azure-tools/json"; -import { partition } from "lodash"; /** * parses a json pointer, and inserts a string into the returned array diff --git a/packages/extensions/modelerfour/package.json b/packages/extensions/modelerfour/package.json index 45c31c172..e0df59611 100644 --- a/packages/extensions/modelerfour/package.json +++ b/packages/extensions/modelerfour/package.json @@ -59,6 +59,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "lodash": "~4.17.20", diff --git a/packages/extensions/modelerfour/src/checker/plugin-checker.ts b/packages/extensions/modelerfour/src/checker/plugin-checker.ts index 817ed0a5c..0f21b23ef 100644 --- a/packages/extensions/modelerfour/src/checker/plugin-checker.ts +++ b/packages/extensions/modelerfour/src/checker/plugin-checker.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { serialize } from "@azure-tools/codegen"; -import { Host, startSession } from "@autorest/extension-base"; import { codeModelSchema, CodeModel } from "@autorest/codemodel"; +import { Host, startSession } from "@autorest/extension-base"; +import { serialize } from "@azure-tools/codegen"; import { Checker } from "./checker"; export async function processRequest(host: Host) { diff --git a/packages/extensions/modelerfour/src/example/plugin-flattener.ts b/packages/extensions/modelerfour/src/example/plugin-flattener.ts index 8d9294ef1..09e34b0bd 100644 --- a/packages/extensions/modelerfour/src/example/plugin-flattener.ts +++ b/packages/extensions/modelerfour/src/example/plugin-flattener.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { serialize } from "@azure-tools/codegen"; -import { Host, startSession } from "@autorest/extension-base"; import { codeModelSchema, CodeModel } from "@autorest/codemodel"; +import { Host, startSession } from "@autorest/extension-base"; +import { serialize } from "@azure-tools/codegen"; import { Example } from "./example"; export async function processRequest(host: Host) { diff --git a/packages/extensions/modelerfour/src/flattener/flattener.ts b/packages/extensions/modelerfour/src/flattener/flattener.ts index fb03b68a6..5ac0f929d 100644 --- a/packages/extensions/modelerfour/src/flattener/flattener.ts +++ b/packages/extensions/modelerfour/src/flattener/flattener.ts @@ -12,8 +12,8 @@ import { Request, } from "@autorest/codemodel"; import { Session } from "@autorest/extension-base"; -import { isDefined } from "../utils"; import { ModelerFourOptions } from "../modeler/modelerfour-options"; +import { isDefined } from "../utils"; const xmsThreshold = "x-ms-payload-flattening-threshold"; const xmsFlatten = "x-ms-client-flatten"; diff --git a/packages/extensions/modelerfour/src/flattener/plugin-flattener.ts b/packages/extensions/modelerfour/src/flattener/plugin-flattener.ts index 9c67556a1..c3a69da17 100644 --- a/packages/extensions/modelerfour/src/flattener/plugin-flattener.ts +++ b/packages/extensions/modelerfour/src/flattener/plugin-flattener.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { serialize } from "@azure-tools/codegen"; -import { Host, startSession } from "@autorest/extension-base"; import { codeModelSchema, CodeModel } from "@autorest/codemodel"; +import { Host, startSession } from "@autorest/extension-base"; +import { serialize } from "@azure-tools/codegen"; import { Flattener } from "./flattener"; export async function processRequest(host: Host) { diff --git a/packages/extensions/modelerfour/src/grouper/plugin-grouper.ts b/packages/extensions/modelerfour/src/grouper/plugin-grouper.ts index 437a06957..885c5be3b 100644 --- a/packages/extensions/modelerfour/src/grouper/plugin-grouper.ts +++ b/packages/extensions/modelerfour/src/grouper/plugin-grouper.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { serialize } from "@azure-tools/codegen"; -import { Host, startSession } from "@autorest/extension-base"; import { codeModelSchema, CodeModel } from "@autorest/codemodel"; +import { Host, startSession } from "@autorest/extension-base"; +import { serialize } from "@azure-tools/codegen"; import { Grouper } from "./grouper"; export async function processRequest(host: Host) { diff --git a/packages/extensions/modelerfour/src/main.ts b/packages/extensions/modelerfour/src/main.ts index e5f91a21f..d8c67d88b 100644 --- a/packages/extensions/modelerfour/src/main.ts +++ b/packages/extensions/modelerfour/src/main.ts @@ -1,10 +1,10 @@ import "source-map-support/register"; import { AutoRestExtension } from "@autorest/extension-base"; -import { processRequest as modelerfour } from "./modeler/plugin-modelerfour"; -import { processRequest as preNamer } from "./prenamer/plugin-prenamer"; +import { processRequest as checker } from "./checker/plugin-checker"; import { processRequest as flattener } from "./flattener/plugin-flattener"; import { processRequest as grouper } from "./grouper/plugin-grouper"; -import { processRequest as checker } from "./checker/plugin-checker"; +import { processRequest as modelerfour } from "./modeler/plugin-modelerfour"; +import { processRequest as preNamer } from "./prenamer/plugin-prenamer"; import { processRequest as prechecker } from "./quality-precheck/prechecker"; export async function initializePlugins(pluginHost: AutoRestExtension) { diff --git a/packages/extensions/modelerfour/src/modeler/body-processor.ts b/packages/extensions/modelerfour/src/modeler/body-processor.ts index 5929fd439..15e783655 100644 --- a/packages/extensions/modelerfour/src/modeler/body-processor.ts +++ b/packages/extensions/modelerfour/src/modeler/body-processor.ts @@ -2,8 +2,8 @@ import { Session } from "@autorest/extension-base"; import { knownMediaType, KnownMediaType } from "@azure-tools/codegen"; import * as OpenAPI from "@azure-tools/openapi"; import { dereference, Dereferenced } from "@azure-tools/openapi"; -import { isSchemaBinary } from "./schema-utils"; import { groupBy } from "lodash"; +import { isSchemaBinary } from "./schema-utils"; export interface KnownMediaTypeGroupItem { mediaType: string; diff --git a/packages/extensions/modelerfour/src/modeler/interpretations.ts b/packages/extensions/modelerfour/src/modeler/interpretations.ts index fd4367fbe..3945a9e06 100644 --- a/packages/extensions/modelerfour/src/modeler/interpretations.ts +++ b/packages/extensions/modelerfour/src/modeler/interpretations.ts @@ -1,5 +1,3 @@ -import { Session } from "@autorest/extension-base"; -import * as OpenAPI from "@azure-tools/openapi"; import { ChoiceSchema, XmlSerlializationFormat, @@ -9,6 +7,9 @@ import { ChoiceValue, SetType, } from "@autorest/codemodel"; +import { Session } from "@autorest/extension-base"; +import { getPascalIdentifier } from "@azure-tools/codegen"; +import * as OpenAPI from "@azure-tools/openapi"; import { StringFormat, JsonType, @@ -16,7 +17,6 @@ import { includeXDashKeys, includeXDashProperties, } from "@azure-tools/openapi"; -import { getPascalIdentifier } from "@azure-tools/codegen"; import { keyBy } from "lodash"; export interface XMSEnum { modelAsString?: boolean; diff --git a/packages/extensions/modelerfour/src/modeler/modelerfour.ts b/packages/extensions/modelerfour/src/modeler/modelerfour.ts index 726efef41..496597311 100644 --- a/packages/extensions/modelerfour/src/modeler/modelerfour.ts +++ b/packages/extensions/modelerfour/src/modeler/modelerfour.ts @@ -1,17 +1,3 @@ -import { - Model as oai3, - Dereferenced, - dereference, - Refable, - JsonType, - IntegerFormat, - StringFormat, - NumberFormat, - MediaType, - omitXDashProperties, -} from "@azure-tools/openapi"; -import { uniq, every } from "lodash"; -import * as OpenAPI from "@azure-tools/openapi"; import { HttpMethod, HttpModel, @@ -73,14 +59,28 @@ import { AnyObjectSchema, } from "@autorest/codemodel"; import { Session, Channel } from "@autorest/extension-base"; -import { Interpretations, XMSEnum } from "./interpretations"; import { fail, minimum, pascalCase, KnownMediaType } from "@azure-tools/codegen"; -import { ModelerFourOptions } from "./modelerfour-options"; -import { isContentTypeParameterDefined } from "./utils"; +import { + Model as oai3, + Dereferenced, + dereference, + Refable, + JsonType, + IntegerFormat, + StringFormat, + NumberFormat, + MediaType, + omitXDashProperties, +} from "@azure-tools/openapi"; +import * as OpenAPI from "@azure-tools/openapi"; +import { uniq, every } from "lodash"; +import { isDefined } from "../utils"; import { BodyProcessor } from "./body-processor"; +import { Interpretations, XMSEnum } from "./interpretations"; +import { ModelerFourOptions } from "./modelerfour-options"; import { isSchemaAnEnum, isSchemaBinary } from "./schema-utils"; import { SecurityProcessor } from "./security-processor"; -import { isDefined } from "../utils"; +import { isContentTypeParameterDefined } from "./utils"; /** adds only if the item is not in the collection already * diff --git a/packages/extensions/modelerfour/src/modeler/plugin-modelerfour.ts b/packages/extensions/modelerfour/src/modeler/plugin-modelerfour.ts index 7e6e56b66..9fa946cb2 100644 --- a/packages/extensions/modelerfour/src/modeler/plugin-modelerfour.ts +++ b/packages/extensions/modelerfour/src/modeler/plugin-modelerfour.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { deserialize, serialize } from "@azure-tools/codegen"; +import { codeModelSchema, CodeModel } from "@autorest/codemodel"; import { Host, startSession } from "@autorest/extension-base"; +import { deserialize, serialize } from "@azure-tools/codegen"; import * as OpenAPI from "@azure-tools/openapi"; import { ModelerFour } from "./modelerfour"; -import { codeModelSchema, CodeModel } from "@autorest/codemodel"; export async function processRequest(host: Host) { const debug = (await host.GetValue("debug")) || false; diff --git a/packages/extensions/modelerfour/src/modeler/security-processor.test.ts b/packages/extensions/modelerfour/src/modeler/security-processor.test.ts index c0b80d189..5fbbfed80 100644 --- a/packages/extensions/modelerfour/src/modeler/security-processor.test.ts +++ b/packages/extensions/modelerfour/src/modeler/security-processor.test.ts @@ -1,8 +1,8 @@ -import { createTestSessionFromModel } from "../../test/utils"; -import { SecurityProcessor } from "./security-processor"; -import oai3, { ParameterLocation, SecurityType } from "@azure-tools/openapi"; -import { Interpretations } from "./interpretations"; import { AADTokenSecurityScheme, AzureKeySecurityScheme } from "@autorest/codemodel"; +import oai3, { ParameterLocation, SecurityType } from "@azure-tools/openapi"; +import { createTestSessionFromModel } from "../../test/utils"; +import { Interpretations } from "./interpretations"; +import { SecurityProcessor } from "./security-processor"; const baseOpenapiSpec = { openApi: "3.0.0", diff --git a/packages/extensions/modelerfour/src/prenamer/naming-utils.ts b/packages/extensions/modelerfour/src/prenamer/naming-utils.ts index d7ec6a3bb..567e58d70 100644 --- a/packages/extensions/modelerfour/src/prenamer/naming-utils.ts +++ b/packages/extensions/modelerfour/src/prenamer/naming-utils.ts @@ -1,6 +1,6 @@ import { Languages } from "@autorest/codemodel"; -import { removeSequentialDuplicates, fixLeadingNumber, deconstruct, Style, Styler } from "@azure-tools/codegen"; import { Session } from "@autorest/extension-base"; +import { removeSequentialDuplicates, fixLeadingNumber, deconstruct, Style, Styler } from "@azure-tools/codegen"; export function getNameOptions(typeName: string, components: Array) { const result = new Set(); diff --git a/packages/extensions/modelerfour/src/prenamer/plugin-prenamer.ts b/packages/extensions/modelerfour/src/prenamer/plugin-prenamer.ts index 29caa24c5..a3e0106b3 100644 --- a/packages/extensions/modelerfour/src/prenamer/plugin-prenamer.ts +++ b/packages/extensions/modelerfour/src/prenamer/plugin-prenamer.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { serialize } from "@azure-tools/codegen"; -import { Host, startSession } from "@autorest/extension-base"; import { codeModelSchema, CodeModel } from "@autorest/codemodel"; +import { Host, startSession } from "@autorest/extension-base"; +import { serialize } from "@azure-tools/codegen"; import { PreNamer } from "./prenamer"; export async function processRequest(host: Host) { diff --git a/packages/extensions/modelerfour/src/prenamer/prenamer.ts b/packages/extensions/modelerfour/src/prenamer/prenamer.ts index a1667499d..9be595ed1 100644 --- a/packages/extensions/modelerfour/src/prenamer/prenamer.ts +++ b/packages/extensions/modelerfour/src/prenamer/prenamer.ts @@ -17,9 +17,9 @@ import { } from "@autorest/codemodel"; import { Session } from "@autorest/extension-base"; import { selectName, Style } from "@azure-tools/codegen"; +import { partition } from "lodash"; import { ModelerFourOptions } from "../modeler/modelerfour-options"; import { getNameOptions, isUnassigned, ScopeNamer, setName, setNameAllowEmpty } from "./naming-utils"; -import { partition } from "lodash"; export class PreNamer { codeModel: CodeModel; diff --git a/packages/extensions/modelerfour/src/quality-precheck/prechecker.ts b/packages/extensions/modelerfour/src/quality-precheck/prechecker.ts index 7db67fd3c..6bec9cc13 100644 --- a/packages/extensions/modelerfour/src/quality-precheck/prechecker.ts +++ b/packages/extensions/modelerfour/src/quality-precheck/prechecker.ts @@ -1,4 +1,6 @@ -import { Session } from "@autorest/extension-base"; +import { Session, Host, startSession } from "@autorest/extension-base"; + +import { serialize } from "@azure-tools/codegen"; import { Model as oai3, Refable, @@ -9,11 +11,9 @@ import { StringFormat, } from "@azure-tools/openapi"; -import { serialize } from "@azure-tools/codegen"; -import { Host, startSession } from "@autorest/extension-base"; +import { getDiff } from "recursive-diff"; import { Interpretations } from "../modeler/interpretations"; -import { getDiff } from "recursive-diff"; import { ModelerFourOptions } from "../modeler/modelerfour-options"; import { DuplicateSchemaMerger } from "./duplicate-schema-merger"; diff --git a/packages/extensions/modelerfour/test/modeler/modelerfour-utils.ts b/packages/extensions/modelerfour/test/modeler/modelerfour-utils.ts index f90c29709..9a71e30aa 100644 --- a/packages/extensions/modelerfour/test/modeler/modelerfour-utils.ts +++ b/packages/extensions/modelerfour/test/modeler/modelerfour-utils.ts @@ -1,7 +1,7 @@ import { CodeModel } from "@autorest/codemodel"; import { Model } from "@azure-tools/openapi"; -import { ModelerFour } from "../../src/modeler/modelerfour"; import { ModelerFourOptions } from "modeler/modelerfour-options"; +import { ModelerFour } from "../../src/modeler/modelerfour"; import { createTestSessionFromModel } from "../utils"; const modelerfourOptions: ModelerFourOptions = { diff --git a/packages/extensions/modelerfour/test/modeler/modelerfour.requests.test.ts b/packages/extensions/modelerfour/test/modeler/modelerfour.requests.test.ts index ec8155962..e7b573fe5 100644 --- a/packages/extensions/modelerfour/test/modeler/modelerfour.requests.test.ts +++ b/packages/extensions/modelerfour/test/modeler/modelerfour.requests.test.ts @@ -1,12 +1,12 @@ /* eslint-disable jest/no-standalone-expect */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ +import assert from "assert"; import { CodeModel, DictionarySchema, HttpHeader, Operation, Parameter, SealedChoiceSchema } from "@autorest/codemodel"; import { HttpOperation, JsonType, ParameterLocation, RequestBody } from "@azure-tools/openapi"; +import * as oai3 from "@azure-tools/openapi"; import { addOperation, createTestSpec, findByName } from "../utils"; import { runModeler } from "./modelerfour-utils"; -import * as oai3 from "@azure-tools/openapi"; -import assert from "assert"; async function runModelerWithOperation( method: string, diff --git a/packages/extensions/modelerfour/test/modeler/modelerfour.schemas.test.ts b/packages/extensions/modelerfour/test/modeler/modelerfour.schemas.test.ts index d87d54ed6..4a625abad 100644 --- a/packages/extensions/modelerfour/test/modeler/modelerfour.schemas.test.ts +++ b/packages/extensions/modelerfour/test/modeler/modelerfour.schemas.test.ts @@ -1,6 +1,6 @@ +import assert from "assert"; import { ChoiceSchema, ConstantSchema, SealedChoiceSchema } from "@autorest/codemodel"; import { JsonType } from "@azure-tools/openapi"; -import assert from "assert"; import { addSchema, assertSchema, createTestSpec, findByName } from "../utils"; import { runModeler } from "./modelerfour-utils"; diff --git a/packages/extensions/modelerfour/test/quality-precheck/prechecker.test.ts b/packages/extensions/modelerfour/test/quality-precheck/prechecker.test.ts index e6b048c56..326fd4a4a 100644 --- a/packages/extensions/modelerfour/test/quality-precheck/prechecker.test.ts +++ b/packages/extensions/modelerfour/test/quality-precheck/prechecker.test.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ -import { addSchema, createTestSessionFromModel, createTestSpec } from "../utils"; -import { QualityPreChecker } from "../../src/quality-precheck/prechecker"; +import assert from "assert"; import { Model, Refable, Dereferenced, dereference, Schema } from "@azure-tools/openapi"; import { ModelerFourOptions } from "modeler/modelerfour-options"; -import assert from "assert"; +import { QualityPreChecker } from "../../src/quality-precheck/prechecker"; +import { addSchema, createTestSessionFromModel, createTestSpec } from "../utils"; class PreCheckerClient { private constructor(private input: Model, public result: Model) {} diff --git a/packages/extensions/modelerfour/test/scenarios/scenarios.test.ts b/packages/extensions/modelerfour/test/scenarios/scenarios.test.ts index 579cd65d1..a273bc5a7 100644 --- a/packages/extensions/modelerfour/test/scenarios/scenarios.test.ts +++ b/packages/extensions/modelerfour/test/scenarios/scenarios.test.ts @@ -1,9 +1,9 @@ -import { createTestSessionFromFiles } from "../utils"; -import { ModelerFour } from "../../src/modeler/modelerfour"; import { readdirSync } from "fs"; +import { codeModelSchema } from "@autorest/codemodel"; import { serialize } from "@azure-tools/codegen"; import { Model } from "@azure-tools/openapi"; -import { codeModelSchema } from "@autorest/codemodel"; +import { ModelerFour } from "../../src/modeler/modelerfour"; +import { createTestSessionFromFiles } from "../utils"; const cfg = { modelerfour: { diff --git a/packages/extensions/modelerfour/test/utils/test-session.ts b/packages/extensions/modelerfour/test/utils/test-session.ts index 99be46ed6..8cea94b9d 100644 --- a/packages/extensions/modelerfour/test/utils/test-session.ts +++ b/packages/extensions/modelerfour/test/utils/test-session.ts @@ -1,6 +1,6 @@ +import { Session, startSession } from "@autorest/extension-base"; import { readFile } from "@azure-tools/async-io"; import { deserialize, fail } from "@azure-tools/codegen"; -import { Session, startSession } from "@autorest/extension-base"; import { Model } from "@azure-tools/openapi"; export interface TestSessionInput { diff --git a/packages/libs/codegen/package.json b/packages/libs/codegen/package.json index a34c9fdbc..01d72e240 100644 --- a/packages/libs/codegen/package.json +++ b/packages/libs/codegen/package.json @@ -46,6 +46,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "rimraf": "^3.0.2", diff --git a/packages/libs/codegen/src/exec.ts b/packages/libs/codegen/src/exec.ts index 2517e61fc..ab3179033 100644 --- a/packages/libs/codegen/src/exec.ts +++ b/packages/libs/codegen/src/exec.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { isDirectory, isFile, readdir } from "@azure-tools/async-io"; import { spawn } from "child_process"; import * as path from "path"; +import { isDirectory, isFile, readdir } from "@azure-tools/async-io"; export function cmdlineToArray( text: string, diff --git a/packages/libs/codegen/src/utility.ts b/packages/libs/codegen/src/utility.ts index 07879670d..8a155412d 100644 --- a/packages/libs/codegen/src/utility.ts +++ b/packages/libs/codegen/src/utility.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as aio from "@azure-tools/async-io"; import { join } from "path"; +import * as aio from "@azure-tools/async-io"; function getAllPropertyNames(obj: any) { const props = new Array(); diff --git a/packages/libs/codemodel/package.json b/packages/libs/codemodel/package.json index e0af6dd62..de6d4c669 100644 --- a/packages/libs/codemodel/package.json +++ b/packages/libs/codemodel/package.json @@ -44,6 +44,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "glob": "~7.1.4", "rimraf": "^3.0.2", diff --git a/packages/libs/codemodel/src/model/common/aspect.ts b/packages/libs/codemodel/src/model/common/aspect.ts index ac9c1e8c0..f19aa9026 100644 --- a/packages/libs/codemodel/src/model/common/aspect.ts +++ b/packages/libs/codemodel/src/model/common/aspect.ts @@ -1,8 +1,8 @@ +import { DeepPartial } from "@azure-tools/codegen"; import { ApiVersions } from "./api-version"; import { Deprecation } from "./deprecation"; import { ExternalDocumentation } from "./external-documentation"; import { Metadata } from "./metadata"; -import { DeepPartial } from "@azure-tools/codegen"; /** the base interface that represents an aspect of the model. */ export interface Aspect extends Metadata { diff --git a/packages/libs/codemodel/src/model/common/code-model.ts b/packages/libs/codemodel/src/model/common/code-model.ts index df509668c..0f87f66d5 100644 --- a/packages/libs/codemodel/src/model/common/code-model.ts +++ b/packages/libs/codemodel/src/model/common/code-model.ts @@ -1,9 +1,9 @@ -import { Metadata } from "./metadata"; -import { Schemas } from "./schemas"; -import { Info } from "./info"; -import { OperationGroup } from "./operation"; import { DeepPartial, enableSourceTracking } from "@azure-tools/codegen"; +import { Info } from "./info"; +import { Metadata } from "./metadata"; +import { OperationGroup } from "./operation"; import { Parameter } from "./parameter"; +import { Schemas } from "./schemas"; import { Security } from "./security"; /** the model that contains all the information required to generate a service api */ diff --git a/packages/libs/codemodel/src/model/common/external-documentation.ts b/packages/libs/codemodel/src/model/common/external-documentation.ts index ed520a501..b749f2af2 100644 --- a/packages/libs/codemodel/src/model/common/external-documentation.ts +++ b/packages/libs/codemodel/src/model/common/external-documentation.ts @@ -1,6 +1,6 @@ +import { Initializer, DeepPartial } from "@azure-tools/codegen"; import { Extensions } from "./extensions"; import { uri } from "./uri"; -import { Initializer, DeepPartial } from "@azure-tools/codegen"; /** a reference to external documentation */ export interface ExternalDocumentation extends Extensions { diff --git a/packages/libs/codemodel/src/model/common/info.ts b/packages/libs/codemodel/src/model/common/info.ts index 08e842fdc..d0488967a 100644 --- a/packages/libs/codemodel/src/model/common/info.ts +++ b/packages/libs/codemodel/src/model/common/info.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Extensions } from "./extensions"; -import { uri } from "./uri"; -import { ExternalDocumentation } from "./external-documentation"; import { Initializer, DeepPartial } from "@azure-tools/codegen"; +import { Extensions } from "./extensions"; +import { ExternalDocumentation } from "./external-documentation"; +import { uri } from "./uri"; export type email = string; diff --git a/packages/libs/codemodel/src/model/common/metadata.ts b/packages/libs/codemodel/src/model/common/metadata.ts index e6ef936e3..310904c3a 100644 --- a/packages/libs/codemodel/src/model/common/metadata.ts +++ b/packages/libs/codemodel/src/model/common/metadata.ts @@ -1,8 +1,8 @@ +import { Initializer, DeepPartial } from "@azure-tools/codegen"; +import { SetType } from "../../tag"; import { Extensions } from "./extensions"; import { Languages } from "./languages"; import { Protocols } from "./protocols"; -import { Initializer, DeepPartial } from "@azure-tools/codegen"; -import { SetType } from "../../tag"; /** common pattern for Metadata on aspects */ export interface Metadata extends Extensions { diff --git a/packages/libs/codemodel/src/model/common/operation.ts b/packages/libs/codemodel/src/model/common/operation.ts index 1e77d0562..61f9c3e48 100644 --- a/packages/libs/codemodel/src/model/common/operation.ts +++ b/packages/libs/codemodel/src/model/common/operation.ts @@ -1,9 +1,9 @@ +import { DeepPartial } from "@azure-tools/codegen"; +import { ApiVersion } from "./api-version"; +import { Aspect } from "./aspect"; +import { Metadata } from "./metadata"; import { Parameter, ImplementationLocation } from "./parameter"; import { Response } from "./response"; -import { Metadata } from "./metadata"; -import { Aspect } from "./aspect"; -import { ApiVersion } from "./api-version"; -import { DeepPartial } from "@azure-tools/codegen"; import { SchemaType } from "./schema-type"; /** represents a single callable endpoint with a discrete set of inputs, and any number of output possibilities (responses or exceptions) */ diff --git a/packages/libs/codemodel/src/model/common/parameter.ts b/packages/libs/codemodel/src/model/common/parameter.ts index 609726e06..d51c1ff1e 100644 --- a/packages/libs/codemodel/src/model/common/parameter.ts +++ b/packages/libs/codemodel/src/model/common/parameter.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Value } from "./value"; import { DeepPartial } from "@azure-tools/codegen"; -import { Schema } from "./schema"; import { Property } from "./property"; +import { Schema } from "./schema"; +import { Value } from "./value"; export enum ImplementationLocation { /** should be exposed as a method parameter in the operation */ diff --git a/packages/libs/codemodel/src/model/common/property.ts b/packages/libs/codemodel/src/model/common/property.ts index 9fbf929cc..32d4f3b40 100644 --- a/packages/libs/codemodel/src/model/common/property.ts +++ b/packages/libs/codemodel/src/model/common/property.ts @@ -1,8 +1,8 @@ +import { Initializer, DeepPartial } from "@azure-tools/codegen"; +import { Schema } from "./schema"; import { uid } from "./uid"; -import { Initializer, DeepPartial } from "@azure-tools/codegen"; import { Value } from "./value"; -import { Schema } from "./schema"; /** a property is a child value in an object */ export interface Property extends Value { diff --git a/packages/libs/codemodel/src/model/common/response.ts b/packages/libs/codemodel/src/model/common/response.ts index c70934e07..95dbf88c2 100644 --- a/packages/libs/codemodel/src/model/common/response.ts +++ b/packages/libs/codemodel/src/model/common/response.ts @@ -1,6 +1,6 @@ +import { Initializer, DeepPartial } from "@azure-tools/codegen"; import { Metadata } from "./metadata"; import { Schema } from "./schema"; -import { Initializer, DeepPartial } from "@azure-tools/codegen"; /** a response from a service. */ export interface Response extends Metadata {} diff --git a/packages/libs/codemodel/src/model/common/schema.ts b/packages/libs/codemodel/src/model/common/schema.ts index 82c02e591..25715b684 100644 --- a/packages/libs/codemodel/src/model/common/schema.ts +++ b/packages/libs/codemodel/src/model/common/schema.ts @@ -1,9 +1,9 @@ -import { Aspect } from "./aspect"; -import { SerializationFormats } from "./formats"; -import { AllSchemaTypes } from "./schema-type"; import { DeepPartial } from "@azure-tools/codegen"; +import { Aspect } from "./aspect"; import { Extensions } from "./extensions"; +import { SerializationFormats } from "./formats"; import { Languages } from "./languages"; +import { AllSchemaTypes } from "./schema-type"; export interface SerializationFormat extends Extensions, Record {} diff --git a/packages/libs/codemodel/src/model/common/schemas.ts b/packages/libs/codemodel/src/model/common/schemas.ts index bfd77b2ff..0f66363a4 100644 --- a/packages/libs/codemodel/src/model/common/schemas.ts +++ b/packages/libs/codemodel/src/model/common/schemas.ts @@ -1,21 +1,21 @@ -import { ChoiceSchema, SealedChoiceSchema } from "./schemas/choice"; +import { finished } from "stream"; import { camelCase } from "@azure-tools/codegen"; +import { Schema, PrimitiveSchema } from "./schema"; import { SchemaType } from "./schema-type"; +import { AnyObjectSchema, AnySchema } from "./schemas/any"; import { ArraySchema, ByteArraySchema } from "./schemas/array"; +import { BinarySchema } from "./schemas/binary"; +import { ChoiceSchema, SealedChoiceSchema } from "./schemas/choice"; +import { ConditionalSchema, SealedConditionalSchema } from "./schemas/conditional"; +import { ConstantSchema } from "./schemas/constant"; import { DictionarySchema } from "./schemas/dictionary"; -import { BooleanSchema, CharSchema } from "./schemas/primitive"; +import { FlagSchema } from "./schemas/flag"; import { NumberSchema } from "./schemas/number"; import { ObjectSchema, GroupSchema } from "./schemas/object"; +import { BooleanSchema, CharSchema } from "./schemas/primitive"; +import { OrSchema, XorSchema } from "./schemas/relationship"; import { StringSchema, UuidSchema, UriSchema, CredentialSchema, ODataQuerySchema } from "./schemas/string"; import { UnixTimeSchema, DateSchema, DateTimeSchema, DurationSchema, TimeSchema } from "./schemas/time"; -import { Schema, PrimitiveSchema } from "./schema"; -import { ConditionalSchema, SealedConditionalSchema } from "./schemas/conditional"; -import { FlagSchema } from "./schemas/flag"; -import { ConstantSchema } from "./schemas/constant"; -import { OrSchema, XorSchema } from "./schemas/relationship"; -import { BinarySchema } from "./schemas/binary"; -import { finished } from "stream"; -import { AnyObjectSchema, AnySchema } from "./schemas/any"; export { SchemaUsage, SchemaContext } from "./schemas/usage"; diff --git a/packages/libs/codemodel/src/model/common/schemas/any.ts b/packages/libs/codemodel/src/model/common/schemas/any.ts index 3095ab55a..fe3a07c0e 100644 --- a/packages/libs/codemodel/src/model/common/schemas/any.ts +++ b/packages/libs/codemodel/src/model/common/schemas/any.ts @@ -1,6 +1,6 @@ +import { DeepPartial } from "@azure-tools/codegen"; import { Schema } from "../schema"; import { SchemaType } from "../schema-type"; -import { DeepPartial } from "@azure-tools/codegen"; export interface AnySchema extends Schema {} diff --git a/packages/libs/codemodel/src/model/common/schemas/array.ts b/packages/libs/codemodel/src/model/common/schemas/array.ts index 363b28cb2..13fb52ec1 100644 --- a/packages/libs/codemodel/src/model/common/schemas/array.ts +++ b/packages/libs/codemodel/src/model/common/schemas/array.ts @@ -1,6 +1,6 @@ +import { DeepPartial } from "@azure-tools/codegen"; import { Schema, ValueSchema } from "../schema"; import { SchemaType } from "../schema-type"; -import { DeepPartial } from "@azure-tools/codegen"; /** a Schema that represents and array of values */ export interface ArraySchema extends ValueSchema { diff --git a/packages/libs/codemodel/src/model/common/schemas/binary.ts b/packages/libs/codemodel/src/model/common/schemas/binary.ts index defd21760..7141ff93a 100644 --- a/packages/libs/codemodel/src/model/common/schemas/binary.ts +++ b/packages/libs/codemodel/src/model/common/schemas/binary.ts @@ -1,5 +1,5 @@ -import { Schema } from "../schema"; import { DeepPartial } from "@azure-tools/codegen"; +import { Schema } from "../schema"; import { SchemaType } from "../schema-type"; export interface BinarySchema extends Schema {} diff --git a/packages/libs/codemodel/src/model/common/schemas/choice.ts b/packages/libs/codemodel/src/model/common/schemas/choice.ts index 920e4af3c..4d2473004 100644 --- a/packages/libs/codemodel/src/model/common/schemas/choice.ts +++ b/packages/libs/codemodel/src/model/common/schemas/choice.ts @@ -1,9 +1,9 @@ -import { SchemaType } from "../schema-type"; -import { PrimitiveSchema, ValueSchema, Schema } from "../schema"; -import { Languages } from "../languages"; -import { Extensions } from "../extensions"; -import { StringSchema } from "./string"; import { Initializer, DeepPartial } from "@azure-tools/codegen"; +import { Extensions } from "../extensions"; +import { Languages } from "../languages"; +import { PrimitiveSchema, ValueSchema, Schema } from "../schema"; +import { SchemaType } from "../schema-type"; +import { StringSchema } from "./string"; /** a schema that represents a choice of several values (ie, an 'enum') */ export interface ChoiceSchema extends ValueSchema { diff --git a/packages/libs/codemodel/src/model/common/schemas/conditional.ts b/packages/libs/codemodel/src/model/common/schemas/conditional.ts index 613c590bc..e24df5d84 100644 --- a/packages/libs/codemodel/src/model/common/schemas/conditional.ts +++ b/packages/libs/codemodel/src/model/common/schemas/conditional.ts @@ -1,10 +1,10 @@ -import { SchemaType } from "../schema-type"; -import { PrimitiveSchema, ValueSchema, Schema } from "../schema"; -import { Languages } from "../languages"; -import { Extensions } from "../extensions"; -import { StringSchema } from "./string"; import { Initializer, DeepPartial } from "@azure-tools/codegen"; +import { Extensions } from "../extensions"; +import { Languages } from "../languages"; +import { PrimitiveSchema, ValueSchema, Schema } from "../schema"; +import { SchemaType } from "../schema-type"; import { Value } from "../value"; +import { StringSchema } from "./string"; /** a schema that represents a value dependent on another */ export interface ConditionalSchema extends ValueSchema { diff --git a/packages/libs/codemodel/src/model/common/schemas/constant.ts b/packages/libs/codemodel/src/model/common/schemas/constant.ts index b217f03c1..3f9f444b1 100644 --- a/packages/libs/codemodel/src/model/common/schemas/constant.ts +++ b/packages/libs/codemodel/src/model/common/schemas/constant.ts @@ -1,8 +1,8 @@ -import { SchemaType } from "../schema-type"; -import { Schema, ValueSchema } from "../schema"; -import { Languages } from "../languages"; -import { Extensions } from "../extensions"; import { Initializer, DeepPartial } from "@azure-tools/codegen"; +import { Extensions } from "../extensions"; +import { Languages } from "../languages"; +import { Schema, ValueSchema } from "../schema"; +import { SchemaType } from "../schema-type"; /** a container for the actual constant value */ export interface ConstantValue extends Extensions { diff --git a/packages/libs/codemodel/src/model/common/schemas/dictionary.ts b/packages/libs/codemodel/src/model/common/schemas/dictionary.ts index 7ddf63178..31891c8e9 100644 --- a/packages/libs/codemodel/src/model/common/schemas/dictionary.ts +++ b/packages/libs/codemodel/src/model/common/schemas/dictionary.ts @@ -1,6 +1,6 @@ -import { SchemaType } from "../schema-type"; -import { Schema, ComplexSchema } from "../schema"; import { DeepPartial } from "@azure-tools/codegen"; +import { Schema, ComplexSchema } from "../schema"; +import { SchemaType } from "../schema-type"; /** a schema that represents a key-value collection */ export interface DictionarySchema extends ComplexSchema { diff --git a/packages/libs/codemodel/src/model/common/schemas/flag.ts b/packages/libs/codemodel/src/model/common/schemas/flag.ts index 70a634dd3..03b02d826 100644 --- a/packages/libs/codemodel/src/model/common/schemas/flag.ts +++ b/packages/libs/codemodel/src/model/common/schemas/flag.ts @@ -1,8 +1,8 @@ -import { SchemaType } from "../schema-type"; -import { Schema, ValueSchema } from "../schema"; -import { Languages } from "../languages"; -import { Extensions } from "../extensions"; import { Initializer, DeepPartial } from "@azure-tools/codegen"; +import { Extensions } from "../extensions"; +import { Languages } from "../languages"; +import { Schema, ValueSchema } from "../schema"; +import { SchemaType } from "../schema-type"; export interface FlagValue extends Extensions { /** per-language information for this value */ diff --git a/packages/libs/codemodel/src/model/common/schemas/number.ts b/packages/libs/codemodel/src/model/common/schemas/number.ts index 6500a178d..aac52f9f9 100644 --- a/packages/libs/codemodel/src/model/common/schemas/number.ts +++ b/packages/libs/codemodel/src/model/common/schemas/number.ts @@ -1,8 +1,8 @@ -import { SchemaType } from "../schema-type"; -import { Schema, ValueSchema, PrimitiveSchema } from "../schema"; -import { Languages } from "../languages"; -import { Extensions } from "../extensions"; import { Initializer, DeepPartial } from "@azure-tools/codegen"; +import { Extensions } from "../extensions"; +import { Languages } from "../languages"; +import { Schema, ValueSchema, PrimitiveSchema } from "../schema"; +import { SchemaType } from "../schema-type"; /** returns true if the given schema is a NumberSchema */ export function isNumberSchema(schema: Schema): schema is NumberSchema { diff --git a/packages/libs/codemodel/src/model/common/schemas/object.ts b/packages/libs/codemodel/src/model/common/schemas/object.ts index 348d6f506..2e895f059 100644 --- a/packages/libs/codemodel/src/model/common/schemas/object.ts +++ b/packages/libs/codemodel/src/model/common/schemas/object.ts @@ -1,8 +1,8 @@ -import { SchemaType } from "../schema-type"; -import { Schema, ComplexSchema } from "../schema"; import { DeepPartial } from "@azure-tools/codegen"; -import { Property } from "../property"; import { Parameter } from "../parameter"; +import { Property } from "../property"; +import { Schema, ComplexSchema } from "../schema"; +import { SchemaType } from "../schema-type"; import { SchemaUsage } from "./usage"; export interface Relations { diff --git a/packages/libs/codemodel/src/model/common/schemas/primitive.ts b/packages/libs/codemodel/src/model/common/schemas/primitive.ts index 8e91937dd..bbcb3a106 100644 --- a/packages/libs/codemodel/src/model/common/schemas/primitive.ts +++ b/packages/libs/codemodel/src/model/common/schemas/primitive.ts @@ -1,6 +1,6 @@ -import { SchemaType } from "../schema-type"; -import { Schema, PrimitiveSchema } from "../schema"; import { Initializer, DeepPartial } from "@azure-tools/codegen"; +import { Schema, PrimitiveSchema } from "../schema"; +import { SchemaType } from "../schema-type"; /** a schema that represents a boolean value */ export interface BooleanSchema extends PrimitiveSchema { diff --git a/packages/libs/codemodel/src/model/common/schemas/relationship.ts b/packages/libs/codemodel/src/model/common/schemas/relationship.ts index aa1a1928e..a61aa2b72 100644 --- a/packages/libs/codemodel/src/model/common/schemas/relationship.ts +++ b/packages/libs/codemodel/src/model/common/schemas/relationship.ts @@ -1,6 +1,6 @@ +import { DeepPartial } from "@azure-tools/codegen"; import { ComplexSchema, Schema } from "../schema"; import { SchemaType } from "../schema-type"; -import { DeepPartial } from "@azure-tools/codegen"; /** an OR relationship between several schemas * diff --git a/packages/libs/codemodel/src/model/common/schemas/string.ts b/packages/libs/codemodel/src/model/common/schemas/string.ts index 9a6f45b9f..fbc7e527d 100644 --- a/packages/libs/codemodel/src/model/common/schemas/string.ts +++ b/packages/libs/codemodel/src/model/common/schemas/string.ts @@ -1,6 +1,6 @@ +import { DeepPartial } from "@azure-tools/codegen"; import { PrimitiveSchema, Schema } from "../schema"; import { SchemaType } from "../schema-type"; -import { DeepPartial } from "@azure-tools/codegen"; /** a Schema that represents a string value */ export interface StringSchema extends PrimitiveSchema { diff --git a/packages/libs/codemodel/src/model/common/schemas/time.ts b/packages/libs/codemodel/src/model/common/schemas/time.ts index 12cda6b1b..89b266c47 100644 --- a/packages/libs/codemodel/src/model/common/schemas/time.ts +++ b/packages/libs/codemodel/src/model/common/schemas/time.ts @@ -1,6 +1,6 @@ +import { DeepPartial } from "@azure-tools/codegen"; import { PrimitiveSchema, Schema } from "../schema"; import { SchemaType } from "../schema-type"; -import { DeepPartial } from "@azure-tools/codegen"; /** a schema that represents a Duration value */ export interface DurationSchema extends PrimitiveSchema { diff --git a/packages/libs/codemodel/src/model/common/value.ts b/packages/libs/codemodel/src/model/common/value.ts index 5863c3b5e..3fefbe30d 100644 --- a/packages/libs/codemodel/src/model/common/value.ts +++ b/packages/libs/codemodel/src/model/common/value.ts @@ -1,6 +1,6 @@ +import { DeepPartial } from "@azure-tools/codegen"; import { Aspect } from "./aspect"; import { Schema } from "./schema"; -import { DeepPartial } from "@azure-tools/codegen"; /** common base interface for properties, parameters and the like. */ export interface Value extends Aspect { diff --git a/packages/libs/codemodel/src/model/http/http.ts b/packages/libs/codemodel/src/model/http/http.ts index fc1d119b7..b72dba788 100644 --- a/packages/libs/codemodel/src/model/http/http.ts +++ b/packages/libs/codemodel/src/model/http/http.ts @@ -1,14 +1,14 @@ -import { SerializationStyle } from "./serialization-style"; -import { HttpMethod } from "./http-method"; -import { ParameterLocation } from "./parameter-location"; -import { Protocol } from "../common/metadata"; -import { StatusCode } from "./status-code"; -import { SecurityRequirement } from "./security"; -import { Schema } from "../common/schema"; import { DeepPartial, KnownMediaType, Initializer } from "@azure-tools/codegen"; import { Extensions } from "../common/extensions"; -import { GroupSchema } from "../common/schemas/object"; import { Languages } from "../common/languages"; +import { Protocol } from "../common/metadata"; +import { Schema } from "../common/schema"; +import { GroupSchema } from "../common/schemas/object"; +import { HttpMethod } from "./http-method"; +import { ParameterLocation } from "./parameter-location"; +import { SecurityRequirement } from "./security"; +import { SerializationStyle } from "./serialization-style"; +import { StatusCode } from "./status-code"; /** extended metadata for HTTP operation parameters */ export interface HttpParameter extends Protocol { diff --git a/packages/libs/codemodel/src/model/yaml-schema.ts b/packages/libs/codemodel/src/model/yaml-schema.ts index 18bc4f8a1..2cdf45a59 100644 --- a/packages/libs/codemodel/src/model/yaml-schema.ts +++ b/packages/libs/codemodel/src/model/yaml-schema.ts @@ -1,21 +1,33 @@ import { Schema, Type, DEFAULT_SCHEMA } from "js-yaml"; - -import { CodeModel } from "./common/code-model"; -import { Metadata, CSharpLanguage, Language } from "./common/metadata"; -import { Parameter, VirtualParameter } from "./common/parameter"; -import { Property } from "./common/property"; -import { Value } from "./common/value"; -import { Operation, Request, OperationGroup } from "./common/operation"; - -import { ChoiceSchema, ChoiceValue, SealedChoiceSchema } from "./common/schemas/choice"; +import { ApiVersion } from "./common/api-version"; import { Aspect } from "./common/aspect"; -import { Schemas } from "./common/schemas"; +import { CodeModel } from "./common/code-model"; import { ExternalDocumentation } from "./common/external-documentation"; import { Contact, Info, License } from "./common/info"; import { Languages } from "./common/languages"; - +import { Metadata, CSharpLanguage, Language } from "./common/metadata"; +import { Operation, Request, OperationGroup } from "./common/operation"; +import { Parameter, VirtualParameter } from "./common/parameter"; +import { Property } from "./common/property"; import { Protocols } from "./common/protocols"; -import { ApiVersion } from "./common/api-version"; +import { Response, SchemaResponse, BinaryResponse } from "./common/response"; +import { Schemas } from "./common/schemas"; +import { AnySchema, AnyObjectSchema } from "./common/schemas/any"; +import { ArraySchema, ByteArraySchema } from "./common/schemas/array"; +import { BinarySchema } from "./common/schemas/binary"; +import { ChoiceSchema, ChoiceValue, SealedChoiceSchema } from "./common/schemas/choice"; +import { ConditionalValue, ConditionalSchema, SealedConditionalSchema } from "./common/schemas/conditional"; +import { ConstantValue, ConstantSchema } from "./common/schemas/constant"; +import { DictionarySchema } from "./common/schemas/dictionary"; +import { FlagSchema, FlagValue } from "./common/schemas/flag"; +import { NumberSchema } from "./common/schemas/number"; +import { GroupSchema, ObjectSchema, Discriminator, Relations, GroupProperty } from "./common/schemas/object"; +import { BooleanSchema, CharSchema } from "./common/schemas/primitive"; +import { OrSchema, XorSchema } from "./common/schemas/relationship"; +import { StringSchema, ODataQuerySchema, CredentialSchema, UriSchema, UuidSchema } from "./common/schemas/string"; +import { DurationSchema, DateTimeSchema, DateSchema, UnixTimeSchema, TimeSchema } from "./common/schemas/time"; +import { AADTokenSecurityScheme, AzureKeySecurityScheme, Security } from "./common/security"; +import { Value } from "./common/value"; import { HttpWithBodyRequest, HttpParameter, @@ -27,21 +39,6 @@ import { HttpModel, HttpHeader, } from "./http/http"; -import { Response, SchemaResponse, BinaryResponse } from "./common/response"; -import { GroupSchema, ObjectSchema, Discriminator, Relations, GroupProperty } from "./common/schemas/object"; -import { FlagSchema, FlagValue } from "./common/schemas/flag"; -import { NumberSchema } from "./common/schemas/number"; -import { StringSchema, ODataQuerySchema, CredentialSchema, UriSchema, UuidSchema } from "./common/schemas/string"; -import { ArraySchema, ByteArraySchema } from "./common/schemas/array"; -import { ConstantValue, ConstantSchema } from "./common/schemas/constant"; -import { BooleanSchema, CharSchema } from "./common/schemas/primitive"; -import { DurationSchema, DateTimeSchema, DateSchema, UnixTimeSchema, TimeSchema } from "./common/schemas/time"; -import { AnySchema, AnyObjectSchema } from "./common/schemas/any"; -import { DictionarySchema } from "./common/schemas/dictionary"; -import { OrSchema, XorSchema } from "./common/schemas/relationship"; -import { BinarySchema } from "./common/schemas/binary"; -import { ConditionalValue, ConditionalSchema, SealedConditionalSchema } from "./common/schemas/conditional"; -import { AADTokenSecurityScheme, AzureKeySecurityScheme, Security } from "./common/security"; function TypeInfo any>(type: U) { return new Type(`!${type.name}`, { diff --git a/packages/libs/common/package.json b/packages/libs/common/package.json index be3976d7f..4cdd147cf 100644 --- a/packages/libs/common/package.json +++ b/packages/libs/common/package.json @@ -36,6 +36,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "rimraf": "^3.0.2", diff --git a/packages/libs/common/src/logging/filter-logger-processor.ts b/packages/libs/common/src/logging/filter-logger-processor.ts index 9fe180270..f3fe4f12c 100644 --- a/packages/libs/common/src/logging/filter-logger-processor.ts +++ b/packages/libs/common/src/logging/filter-logger-processor.ts @@ -1,8 +1,8 @@ import { matches, PathPosition } from "@azure-tools/datastore"; import { JsonPointerTokens } from "@azure-tools/json"; -import { LoggerProcessor } from "."; import { arrayify } from "../utils"; import { AutorestLogger, LogInfo, LogLevel } from "./types"; +import { LoggerProcessor } from "."; export interface LogSuppression { code: string; diff --git a/packages/libs/common/src/logging/formatter.ts b/packages/libs/common/src/logging/formatter.ts index 2274df60d..56a7bfe10 100644 --- a/packages/libs/common/src/logging/formatter.ts +++ b/packages/libs/common/src/logging/formatter.ts @@ -1,9 +1,9 @@ -import { serializeJsonPointer } from "@azure-tools/json"; import { EnhancedPosition } from "@azure-tools/datastore"; -import { EnhancedLogInfo, EnhancedSourceLocation } from "./types"; -import { color } from "../utils"; -import { LogLevel } from "."; +import { serializeJsonPointer } from "@azure-tools/json"; import chalk, { level } from "chalk"; +import { color } from "../utils"; +import { EnhancedLogInfo, EnhancedSourceLocation } from "./types"; +import { LogLevel } from "."; export interface LogFormatter { log(log: EnhancedLogInfo): string; diff --git a/packages/libs/common/src/logging/log-source-enhancer.ts b/packages/libs/common/src/logging/log-source-enhancer.ts index 5fdc81624..189fa90e9 100644 --- a/packages/libs/common/src/logging/log-source-enhancer.ts +++ b/packages/libs/common/src/logging/log-source-enhancer.ts @@ -1,5 +1,5 @@ -import { LogInfo, EnhancedLogInfo, SourceLocation, EnhancedSourceLocation } from "./types"; import { BlameTree, DataStore } from "@azure-tools/datastore"; +import { LogInfo, EnhancedLogInfo, SourceLocation, EnhancedSourceLocation } from "./types"; export class LogSourceEnhancer { public constructor(private dataStore: DataStore) {} diff --git a/packages/libs/common/src/utils/coloring.test.ts b/packages/libs/common/src/utils/coloring.test.ts index b6ff46a6f..cb22e5c88 100644 --- a/packages/libs/common/src/utils/coloring.test.ts +++ b/packages/libs/common/src/utils/coloring.test.ts @@ -1,5 +1,5 @@ -import { color } from "./coloring"; import chalk from "chalk"; +import { color } from "./coloring"; describe("Coloring", () => { it("bold text", () => { diff --git a/packages/libs/configuration/package.json b/packages/libs/configuration/package.json index 9bb9d2375..d266a3bb0 100644 --- a/packages/libs/configuration/package.json +++ b/packages/libs/configuration/package.json @@ -39,6 +39,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "rimraf": "^3.0.2", diff --git a/packages/libs/configuration/src/args/parse-args.ts b/packages/libs/configuration/src/args/parse-args.ts index 65567e1a4..890d233f6 100644 --- a/packages/libs/configuration/src/args/parse-args.ts +++ b/packages/libs/configuration/src/args/parse-args.ts @@ -1,5 +1,5 @@ -import { parseYAMLFast } from "@azure-tools/yaml"; import { join } from "path"; +import { parseYAMLFast } from "@azure-tools/yaml"; import untildify from "untildify"; interface CliArgs { diff --git a/packages/libs/configuration/src/autorest-configuration.ts b/packages/libs/configuration/src/autorest-configuration.ts index 46af2bda5..c461f84ec 100644 --- a/packages/libs/configuration/src/autorest-configuration.ts +++ b/packages/libs/configuration/src/autorest-configuration.ts @@ -1,7 +1,7 @@ -import { AutorestNormalizedConfiguration } from "./autorest-normalized-configuration"; +import { cwd } from "process"; import { IFileSystem } from "@azure-tools/datastore"; import { createFileOrFolderUri, ensureIsFolderUri, isUri, resolveUri, simplifyUri } from "@azure-tools/uri"; -import { cwd } from "process"; +import { AutorestNormalizedConfiguration } from "./autorest-normalized-configuration"; import { mergeConfigurations } from "./configuration-merging"; import { arrayOf } from "./utils"; diff --git a/packages/libs/configuration/src/configuration-file-resolver.ts b/packages/libs/configuration/src/configuration-file-resolver.ts index 14f77a2f4..77b3b157c 100644 --- a/packages/libs/configuration/src/configuration-file-resolver.ts +++ b/packages/libs/configuration/src/configuration-file-resolver.ts @@ -1,7 +1,7 @@ import { AutorestLogger } from "@autorest/common"; import { IFileSystem } from "@azure-tools/datastore"; -import { parseYAMLAst } from "@azure-tools/yaml"; import { ensureIsFolderUri, resolveUri } from "@azure-tools/uri"; +import { parseYAMLAst } from "@azure-tools/yaml"; import { DefaultConfiguration, MagicString } from "./contants"; /** diff --git a/packages/libs/configuration/src/configuration-loader/configuration-loader.ts b/packages/libs/configuration/src/configuration-loader/configuration-loader.ts index 3a418f8bd..4393ab4b7 100644 --- a/packages/libs/configuration/src/configuration-loader/configuration-loader.ts +++ b/packages/libs/configuration/src/configuration-loader/configuration-loader.ts @@ -1,15 +1,15 @@ +import { AutorestLogger, OperationAbortedException } from "@autorest/common"; +import { exists, filePath } from "@azure-tools/async-io"; import { DataStore, IFileSystem, RealFileSystem, CachingFileSystem } from "@azure-tools/datastore"; import { Extension, ExtensionManager, LocalExtension } from "@azure-tools/extension"; import { createFileUri, resolveUri, simplifyUri, fileUriToPath } from "@azure-tools/uri"; -import { AutorestLogger, OperationAbortedException } from "@autorest/common"; import untildify from "untildify"; import { AutorestConfiguration } from "../autorest-configuration"; +import { AutorestNormalizedConfiguration } from "../autorest-normalized-configuration"; import { detectConfigurationFile } from "../configuration-file-resolver"; import { ConfigurationManager, readConfigurationFile } from "../configuration-manager"; -import { getIncludedConfigurationFiles } from "./configuration-require-resolver"; -import { AutorestNormalizedConfiguration } from "../autorest-normalized-configuration"; -import { exists, filePath } from "@azure-tools/async-io"; import { autorestConfigurationProcessor, AutorestRawConfiguration } from "../configuration-schema"; +import { getIncludedConfigurationFiles } from "./configuration-require-resolver"; export interface AutorestConfigurationResult { config: AutorestConfiguration; diff --git a/packages/libs/configuration/src/configuration-schema/processor.ts b/packages/libs/configuration/src/configuration-schema/processor.ts index 1aa900313..a35979106 100644 --- a/packages/libs/configuration/src/configuration-schema/processor.ts +++ b/packages/libs/configuration/src/configuration-schema/processor.ts @@ -1,6 +1,6 @@ +import { inspect } from "util"; import { AutorestLogger } from "@autorest/common"; import { flatMap } from "lodash"; -import { inspect } from "util"; import { ConfigurationProperty, ConfigurationSchema, diff --git a/packages/libs/configuration/src/desugar.ts b/packages/libs/configuration/src/desugar.ts index a38ce4796..d493e115a 100644 --- a/packages/libs/configuration/src/desugar.ts +++ b/packages/libs/configuration/src/desugar.ts @@ -1,8 +1,8 @@ +import { isDirectory, exists } from "@azure-tools/async-io"; import { fetchPackageMetadata } from "@azure-tools/extension"; +import { isUri } from "@azure-tools/uri"; import { omit } from "lodash"; import { AutorestNormalizedConfiguration } from "./autorest-normalized-configuration"; -import { isUri } from "@azure-tools/uri"; -import { isDirectory, exists } from "@azure-tools/async-io"; const desugarUseField = async (use: string[] | string) => { // Create an empty extension manager to be able to call findPackages. diff --git a/packages/libs/configuration/src/literate-yaml/guard.ts b/packages/libs/configuration/src/literate-yaml/guard.ts index ac15829dd..9c50e51f3 100644 --- a/packages/libs/configuration/src/literate-yaml/guard.ts +++ b/packages/libs/configuration/src/literate-yaml/guard.ts @@ -1,5 +1,5 @@ -import { createSandbox } from "@azure-tools/datastore"; import { resolveRValue } from "@autorest/common"; +import { createSandbox } from "@azure-tools/datastore"; const safeEval = createSandbox(); diff --git a/packages/libs/configuration/src/literate-yaml/literate-yaml.ts b/packages/libs/configuration/src/literate-yaml/literate-yaml.ts index 45e83532d..2f62442ca 100644 --- a/packages/libs/configuration/src/literate-yaml/literate-yaml.ts +++ b/packages/libs/configuration/src/literate-yaml/literate-yaml.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { DataHandle, DataSink, indexToPosition } from "@azure-tools/datastore"; -import { getYamlNodeValue } from "@azure-tools/yaml"; -import { validateJson } from "@azure-tools/json"; import { OperationAbortedException, AutorestLogger } from "@autorest/common"; +import { DataHandle, DataSink, indexToPosition } from "@azure-tools/datastore"; +import { validateJson } from "@azure-tools/json"; +import { getYamlNodeValue } from "@azure-tools/yaml"; import { LiterateYamlErrorCodes } from "./error-codes"; import { parseCodeBlocksFromMarkdown } from "./markdown-parser"; diff --git a/packages/libs/configuration/src/utils.ts b/packages/libs/configuration/src/utils.ts index c09d11b14..fd56b31da 100644 --- a/packages/libs/configuration/src/utils.ts +++ b/packages/libs/configuration/src/utils.ts @@ -1,5 +1,5 @@ -import { fileURLToPath, URL, Url } from "url"; import fs from "fs"; +import { fileURLToPath, URL, Url } from "url"; export function isIterable(target: any): target is Iterable { return !!target && typeof target[Symbol.iterator] === "function"; diff --git a/packages/libs/datastore/package.json b/packages/libs/datastore/package.json index c54554eb4..437f21ed7 100644 --- a/packages/libs/datastore/package.json +++ b/packages/libs/datastore/package.json @@ -46,6 +46,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "rimraf": "^3.0.2", diff --git a/packages/libs/datastore/src/data-store/data-handle.ts b/packages/libs/datastore/src/data-store/data-handle.ts index a46c10884..a33ee52a0 100644 --- a/packages/libs/datastore/src/data-store/data-handle.ts +++ b/packages/libs/datastore/src/data-store/data-handle.ts @@ -1,11 +1,11 @@ -import { MappedPosition, Position } from "source-map"; import { promises as fs } from "fs"; import { parseYAMLAst, YamlNode, parseYAMLFast } from "@azure-tools/yaml"; +import { MappedPosition, Position } from "source-map"; +import { JsonPath } from "../json-path/json-path"; import { getLineIndices } from "../parsing/text-utility"; +import { resolvePathPosition } from "../source-map"; import { PathMappedPosition, PathPosition, PathSourceMap } from "../source-map/path-source-map"; import { PositionSourceMap } from "../source-map/position-source-map"; -import { resolvePathPosition } from "../source-map"; -import { JsonPath } from "../json-path/json-path"; export interface Data { status: "loaded" | "unloaded"; diff --git a/packages/libs/datastore/src/data-store/data-sink.ts b/packages/libs/datastore/src/data-store/data-sink.ts index 16e7f2eb1..88fad210a 100644 --- a/packages/libs/datastore/src/data-store/data-sink.ts +++ b/packages/libs/datastore/src/data-store/data-sink.ts @@ -1,9 +1,8 @@ -import { RawSourceMap } from "source-map"; import { fastStringify } from "@azure-tools/yaml"; -import { SourceMapGenerator } from "source-map"; -import { DataHandle } from "./data-handle"; -import { PathMapping } from "../source-map/path-source-map"; +import { SourceMapGenerator, RawSourceMap } from "source-map"; import { addMappingsToSourceMap, Mapping } from "../source-map"; +import { PathMapping } from "../source-map/path-source-map"; +import { DataHandle } from "./data-handle"; export class DataSink { constructor( diff --git a/packages/libs/datastore/src/data-store/data-store.ts b/packages/libs/datastore/src/data-store/data-store.ts index bc0d2934f..0c7fd31aa 100644 --- a/packages/libs/datastore/src/data-store/data-store.ts +++ b/packages/libs/datastore/src/data-store/data-store.ts @@ -3,20 +3,20 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { resolveUri } from "@azure-tools/uri"; -import { RawSourceMap } from "source-map"; -import { IFileSystem } from "../file-system/file-system"; -import { BlameTree } from "../source-map/blaming"; +import { createHash } from "crypto"; import { promises as fs } from "fs"; import { tmpdir } from "os"; import { join } from "path"; +import { resolveUri } from "@azure-tools/uri"; +import { RawSourceMap } from "source-map"; +import { IFileSystem } from "../file-system/file-system"; +import { PathMapping, PathPosition, PathSourceMap, Position, PositionSourceMap } from "../source-map"; +import { BlameTree } from "../source-map/blaming"; -import { createHash } from "crypto"; -import { DataSource } from "./data-source"; -import { ReadThroughDataSource } from "./read-through-data-source"; import { Data, DataHandle } from "./data-handle"; import { DataSink } from "./data-sink"; -import { PathMapping, PathPosition, PathSourceMap, Position, PositionSourceMap } from "../source-map"; +import { DataSource } from "./data-source"; +import { ReadThroughDataSource } from "./read-through-data-source"; const md5 = (content: any) => (content ? createHash("md5").update(JSON.stringify(content)).digest("hex") : null); diff --git a/packages/libs/datastore/src/file-system/enhanced-file-system.ts b/packages/libs/datastore/src/file-system/enhanced-file-system.ts index c474b3f15..225d88b02 100644 --- a/packages/libs/datastore/src/file-system/enhanced-file-system.ts +++ b/packages/libs/datastore/src/file-system/enhanced-file-system.ts @@ -1,5 +1,5 @@ -import { writeString } from "@azure-tools/uri"; import { URL } from "url"; +import { writeString } from "@azure-tools/uri"; import { logger } from "../logger"; import { RealFileSystem } from "./real-file-system"; diff --git a/packages/libs/datastore/src/file-system/real-file-system.test.ts b/packages/libs/datastore/src/file-system/real-file-system.test.ts index ff6acb4be..c7ba3b171 100644 --- a/packages/libs/datastore/src/file-system/real-file-system.test.ts +++ b/packages/libs/datastore/src/file-system/real-file-system.test.ts @@ -1,5 +1,5 @@ -import { ResolveUri, CreateFileOrFolderUri } from "@azure-tools/uri"; import { join } from "path"; +import { ResolveUri, CreateFileOrFolderUri } from "@azure-tools/uri"; import { UriNotFoundError } from "./errors"; import { RealFileSystem } from "./real-file-system"; diff --git a/packages/libs/datastore/src/file-system/real-file-system.ts b/packages/libs/datastore/src/file-system/real-file-system.ts index 79f102a63..b30ed1ff0 100644 --- a/packages/libs/datastore/src/file-system/real-file-system.ts +++ b/packages/libs/datastore/src/file-system/real-file-system.ts @@ -1,8 +1,8 @@ import { enumerateFiles, readUri, writeString } from "@azure-tools/uri"; -import { IFileSystem } from "./file-system"; import * as Constants from "../constants"; -import { UriNotFoundError } from "./errors"; import { logger } from "../logger"; +import { UriNotFoundError } from "./errors"; +import { IFileSystem } from "./file-system"; export class RealFileSystem implements IFileSystem { public constructor() {} diff --git a/packages/libs/datastore/src/graph-builder.ts b/packages/libs/datastore/src/graph-builder.ts index e049b0e15..afa0c4daf 100644 --- a/packages/libs/datastore/src/graph-builder.ts +++ b/packages/libs/datastore/src/graph-builder.ts @@ -1,7 +1,7 @@ -import { createAssignmentMapping } from "./source-map/source-map"; -import { Exception } from "@azure-tools/tasks"; import { JsonPointer, parseJsonPointer } from "@azure-tools/json"; +import { Exception } from "@azure-tools/tasks"; import { PathMapping } from "./source-map/path-source-map"; +import { createAssignmentMapping } from "./source-map/source-map"; export function createGraphProxy( originalFileName: string, diff --git a/packages/libs/datastore/src/json-path/json-path.ts b/packages/libs/datastore/src/json-path/json-path.ts index bcbdd8d91..1d7575721 100644 --- a/packages/libs/datastore/src/json-path/json-path.ts +++ b/packages/libs/datastore/src/json-path/json-path.ts @@ -2,8 +2,8 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import jsonpath from "jsonpath"; import { createSandbox } from "@azure-tools/codegen"; +import jsonpath from "jsonpath"; const safeEval = createSandbox(); diff --git a/packages/libs/datastore/src/main.ts b/packages/libs/datastore/src/main.ts index f4ecebe87..fd605cb57 100644 --- a/packages/libs/datastore/src/main.ts +++ b/packages/libs/datastore/src/main.ts @@ -11,11 +11,8 @@ export * from "./mapping-tree"; export * from "./data-store"; export * from "./cancellation"; export * from "./source-map"; - export { Lazy, LazyPromise } from "./lazy"; export * from "./parsing/text-utility"; - -export * from "./source-map/blaming"; export * from "./processor"; export * from "./transformer-via-pointer"; diff --git a/packages/libs/datastore/src/mapping-tree/mapping-tree.ts b/packages/libs/datastore/src/mapping-tree/mapping-tree.ts index eaea51e2c..a9b56963f 100644 --- a/packages/libs/datastore/src/mapping-tree/mapping-tree.ts +++ b/packages/libs/datastore/src/mapping-tree/mapping-tree.ts @@ -1,5 +1,5 @@ -import { Exception } from "@azure-tools/tasks"; import { JsonPointer, parseJsonPointer } from "@azure-tools/json"; +import { Exception } from "@azure-tools/tasks"; import { JsonPath } from "../json-path/json-path"; import { PathMapping } from "../source-map"; diff --git a/packages/libs/datastore/src/parsing/text-utility.ts b/packages/libs/datastore/src/parsing/text-utility.ts index ff92a73b2..b9a2ec236 100644 --- a/packages/libs/datastore/src/parsing/text-utility.ts +++ b/packages/libs/datastore/src/parsing/text-utility.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { DataHandle } from "../data-store"; import { Position as sourceMapPosition } from "source-map"; +import { DataHandle } from "../data-store"; const regexNewLine = /\r?\n/g; diff --git a/packages/libs/datastore/src/processor.ts b/packages/libs/datastore/src/processor.ts index 9134b2889..b601e9041 100644 --- a/packages/libs/datastore/src/processor.ts +++ b/packages/libs/datastore/src/processor.ts @@ -1,7 +1,7 @@ -import { ProxyObject } from "./graph-builder"; -import { createGraphProxy, Node, ProxyNode, visit } from "./main"; import { parseJsonPointer, serializeJsonPointer } from "@azure-tools/json"; import { cloneDeep } from "lodash"; +import { ProxyObject } from "./graph-builder"; +import { createGraphProxy, Node, ProxyNode, visit } from "./main"; import { PathMapping } from "./source-map/path-source-map"; export interface AnyObject { diff --git a/packages/libs/datastore/src/source-map/blaming.ts b/packages/libs/datastore/src/source-map/blaming.ts index 08a284953..4104d5c4e 100644 --- a/packages/libs/datastore/src/source-map/blaming.ts +++ b/packages/libs/datastore/src/source-map/blaming.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { uniqBy } from "lodash"; import { MappedPosition } from "source-map"; import { DataStore } from "../data-store/data-store"; -import { uniqBy } from "lodash"; import { PathMappedPosition } from "./path-source-map"; /** diff --git a/packages/libs/datastore/src/source-map/path-source-map.test.ts b/packages/libs/datastore/src/source-map/path-source-map.test.ts index 89c97b03d..026b0cd92 100644 --- a/packages/libs/datastore/src/source-map/path-source-map.test.ts +++ b/packages/libs/datastore/src/source-map/path-source-map.test.ts @@ -1,3 +1,4 @@ +import fs from "fs"; import { PathSourceMap } from "./path-source-map"; const store = new Map(); @@ -8,7 +9,6 @@ jest.mock("fs", () => ({ readFile: jest.fn((file) => store.get(file)), }, })); -import fs from "fs"; const source = "source.json"; diff --git a/packages/libs/datastore/src/source-map/source-map.ts b/packages/libs/datastore/src/source-map/source-map.ts index b8b2898d6..3c2daaa52 100644 --- a/packages/libs/datastore/src/source-map/source-map.ts +++ b/packages/libs/datastore/src/source-map/source-map.ts @@ -3,13 +3,13 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { JsonPointerTokens, walk } from "@azure-tools/json"; +import { getYamlNodeByPath, YamlNode, Kind, YamlMapping } from "@azure-tools/yaml"; import { Position, SourceMapGenerator, Mapping } from "source-map"; import { DataHandle } from "../data-store"; import { JsonPath } from "../json-path/json-path"; import { indexToPosition } from "../parsing/text-utility"; -import { getYamlNodeByPath, YamlNode, Kind, YamlMapping } from "@azure-tools/yaml"; import { PathMapping, PathPosition } from "./path-source-map"; -import { JsonPointerTokens, walk } from "@azure-tools/json"; // information to attach to line/column based to get a richer experience export interface PositionEnhancements { diff --git a/packages/libs/deduplication/package.json b/packages/libs/deduplication/package.json index 6cfebcb6e..09a6507af 100644 --- a/packages/libs/deduplication/package.json +++ b/packages/libs/deduplication/package.json @@ -45,6 +45,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "rimraf": "^3.0.2", diff --git a/packages/libs/deduplication/src/main.ts b/packages/libs/deduplication/src/main.ts index 4997dd173..f7dde011f 100644 --- a/packages/libs/deduplication/src/main.ts +++ b/packages/libs/deduplication/src/main.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { toSemver, maximum } from "@azure-tools/codegen"; import { visit } from "@azure-tools/datastore"; import { areSimilar } from "@azure-tools/object-comparison"; -import compareVersions from "compare-versions"; -import { toSemver, maximum } from "@azure-tools/codegen"; import { YieldCPU } from "@azure-tools/tasks"; +import compareVersions from "compare-versions"; import { cloneDeep } from "lodash"; type componentType = diff --git a/packages/libs/extension-base/package.json b/packages/libs/extension-base/package.json index 38e728a92..c60909fba 100644 --- a/packages/libs/extension-base/package.json +++ b/packages/libs/extension-base/package.json @@ -35,6 +35,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "rimraf": "^3.0.2", "typescript": "~4.4.2" diff --git a/packages/libs/extension-base/src/convenience.ts b/packages/libs/extension-base/src/convenience.ts index 9e782acdb..1de32cc0a 100644 --- a/packages/libs/extension-base/src/convenience.ts +++ b/packages/libs/extension-base/src/convenience.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import { createSandbox, deserialize } from "@azure-tools/codegen"; +import { Schema, DEFAULT_SCHEMA } from "js-yaml"; import { Host } from "./exports"; import { Channel, Message, Mapping, RawSourceMap, JsonPath, Position } from "./types"; -import { Schema, DEFAULT_SCHEMA } from "js-yaml"; const safeEval = createSandbox(); diff --git a/packages/libs/extension-base/src/extension-base.ts b/packages/libs/extension-base/src/extension-base.ts index 6e1208201..f10ea70b4 100644 --- a/packages/libs/extension-base/src/extension-base.ts +++ b/packages/libs/extension-base/src/extension-base.ts @@ -1,3 +1,5 @@ +import { basename, dirname } from "path"; +import { Readable } from "stream"; import { createMessageConnection, Logger, @@ -7,9 +9,7 @@ import { NotificationType2, NotificationType4, } from "vscode-jsonrpc"; -import { Readable } from "stream"; import { Mapping, Message, RawSourceMap, Channel } from "./types"; -import { basename, dirname } from "path"; namespace IAutoRestPluginTargetTypes { export const GetPluginNames = new RequestType0, Error, void>("GetPluginNames"); diff --git a/packages/libs/extension/package.json b/packages/libs/extension/package.json index d890bc001..e2c106eb6 100644 --- a/packages/libs/extension/package.json +++ b/packages/libs/extension/package.json @@ -68,6 +68,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "mkdirp": "~0.5.1", diff --git a/packages/libs/extension/src/extension/extension.ts b/packages/libs/extension/src/extension/extension.ts index be8e3d9e5..7e9bbf460 100644 --- a/packages/libs/extension/src/extension/extension.ts +++ b/packages/libs/extension/src/extension/extension.ts @@ -1,8 +1,8 @@ import { ChildProcess } from "child_process"; -import { isFile, readdir, readFile } from "@azure-tools/async-io"; -import { normalize } from "path"; -import { Package } from "./package"; import { readFileSync } from "fs"; +import { normalize } from "path"; +import { isFile, readdir, readFile } from "@azure-tools/async-io"; +import { Package } from "./package"; /** * Extension is an installed Package diff --git a/packages/libs/extension/src/extension/package.ts b/packages/libs/extension/src/extension/package.ts index 3f1cd67f7..569cdc4a6 100644 --- a/packages/libs/extension/src/extension/package.ts +++ b/packages/libs/extension/src/extension/package.ts @@ -1,6 +1,6 @@ +import pacote from "pacote"; import { ExtensionManager } from "../main"; import { Extension } from "./extension"; -import pacote from "pacote"; /** * A Package is a representation of a npm package. diff --git a/packages/libs/extension/src/main.ts b/packages/libs/extension/src/main.ts index 477f4f63e..5b8b4a8ae 100644 --- a/packages/libs/extension/src/main.ts +++ b/packages/libs/extension/src/main.ts @@ -3,25 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { ChildProcess, spawn } from "child_process"; +import { homedir, tmpdir } from "os"; +import { basename, delimiter, dirname, extname, isAbsolute, join, normalize, resolve } from "path"; import { exists, isDirectory, isFile, mkdir, readdir, readFile, rmdir } from "@azure-tools/async-io"; import { Progress, Subscribe } from "@azure-tools/eventing"; import { CriticalSection, Delay, Exception, Mutex, shallowCopy, SharedLock } from "@azure-tools/tasks"; -import { ChildProcess, spawn } from "child_process"; import { resolve as npmResolvePackage } from "npm-package-arg"; -import { homedir, tmpdir } from "os"; import * as pacote from "pacote"; -import { basename, delimiter, dirname, extname, isAbsolute, join, normalize, resolve } from "path"; import * as semver from "semver"; -import { Npm } from "./npm"; -import { PackageManager, PackageManagerType } from "./package-manager"; -import { Yarn } from "./yarn"; -import { - patchPythonPath, - PythonCommandLine, - ExtensionSystemRequirements, - validateExtensionSystemRequirements, -} from "./system-requirements"; -import { Extension, Package } from "./extension"; import { UnresolvedPackageException, InvalidPackageIdentityException, @@ -30,7 +20,17 @@ import { MissingStartCommandException, UnsatisfiedSystemRequirementException, } from "./exceptions"; +import { Extension, Package } from "./extension"; import { logger } from "./logger"; +import { Npm } from "./npm"; +import { PackageManager, PackageManagerType } from "./package-manager"; +import { + patchPythonPath, + PythonCommandLine, + ExtensionSystemRequirements, + validateExtensionSystemRequirements, +} from "./system-requirements"; +import { Yarn } from "./yarn"; function quoteIfNecessary(text: string): string { if (text && text.indexOf(" ") > -1 && text.charAt(0) != '"') { diff --git a/packages/libs/extension/src/system-requirements/dotnet.test.ts b/packages/libs/extension/src/system-requirements/dotnet.test.ts index 5b2174f3b..6efc8bf0a 100644 --- a/packages/libs/extension/src/system-requirements/dotnet.test.ts +++ b/packages/libs/extension/src/system-requirements/dotnet.test.ts @@ -1,5 +1,5 @@ -import { resolveDotnetRequirement } from "./dotnet"; import { execute } from "../exec-cmd"; +import { resolveDotnetRequirement } from "./dotnet"; jest.mock("../exec-cmd"); diff --git a/packages/libs/extension/src/system-requirements/java.test.ts b/packages/libs/extension/src/system-requirements/java.test.ts index 84029ae1e..a28cc4335 100644 --- a/packages/libs/extension/src/system-requirements/java.test.ts +++ b/packages/libs/extension/src/system-requirements/java.test.ts @@ -1,5 +1,5 @@ -import { resolveJavaRequirement } from "./java"; import { execute } from "../exec-cmd"; +import { resolveJavaRequirement } from "./java"; jest.mock("../exec-cmd"); diff --git a/packages/libs/extension/src/system-requirements/python.test.ts b/packages/libs/extension/src/system-requirements/python.test.ts index 8a5d8a3fb..5899f53ee 100644 --- a/packages/libs/extension/src/system-requirements/python.test.ts +++ b/packages/libs/extension/src/system-requirements/python.test.ts @@ -1,5 +1,5 @@ -import { patchPythonPath, PythonCommandLine, resolvePythonRequirement, updatePythonPath } from "./python"; import { execute } from "../exec-cmd"; +import { patchPythonPath, PythonCommandLine, resolvePythonRequirement, updatePythonPath } from "./python"; jest.mock("../exec-cmd"); diff --git a/packages/libs/extension/src/system-requirements/system-requirements.ts b/packages/libs/extension/src/system-requirements/system-requirements.ts index f3dfcabbb..cc64750ac 100644 --- a/packages/libs/extension/src/system-requirements/system-requirements.ts +++ b/packages/libs/extension/src/system-requirements/system-requirements.ts @@ -1,12 +1,12 @@ +import { DotnetExeName, resolveDotnetRequirement } from "./dotnet"; +import { resolveGenericSystemRequirement } from "./generic"; +import { JavaExeName, resolveJavaRequirement } from "./java"; import { ExtensionSystemRequirements, SystemRequirementError, SystemRequirement, SystemRequirementResolution, } from "./models"; -import { DotnetExeName, resolveDotnetRequirement } from "./dotnet"; -import { resolveGenericSystemRequirement } from "./generic"; -import { JavaExeName, resolveJavaRequirement } from "./java"; import { PythonRequirement, resolvePythonRequirement } from "./python"; /** diff --git a/packages/libs/extension/src/system-requirements/version.ts b/packages/libs/extension/src/system-requirements/version.ts index e9d59277c..283a75d8d 100644 --- a/packages/libs/extension/src/system-requirements/version.ts +++ b/packages/libs/extension/src/system-requirements/version.ts @@ -1,6 +1,5 @@ -import { SystemRequirement, SystemRequirementError, SystemRequirementResolution } from "./models"; - import semver from "semver"; +import { SystemRequirement, SystemRequirementError, SystemRequirementResolution } from "./models"; /** * Validate the provided system requirement resolution is satisfying the version requirement if applicable. diff --git a/packages/libs/extension/src/yarn.ts b/packages/libs/extension/src/yarn.ts index 91cac0c64..485dbce70 100644 --- a/packages/libs/extension/src/yarn.ts +++ b/packages/libs/extension/src/yarn.ts @@ -1,7 +1,7 @@ -import { isFile, writeFile } from "@azure-tools/async-io"; import { readFileSync } from "fs"; import { tmpdir } from "os"; import { join, resolve } from "path"; +import { isFile, writeFile } from "@azure-tools/async-io"; import { execute } from "./exec-cmd"; import { DEFAULT_NPM_REGISTRY } from "./npm"; import { ensurePackageJsonExists, InstallOptions, PackageManager } from "./package-manager"; diff --git a/packages/libs/json/package.json b/packages/libs/json/package.json index 2bf455540..0d84c4ed9 100644 --- a/packages/libs/json/package.json +++ b/packages/libs/json/package.json @@ -36,6 +36,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "rimraf": "^3.0.2", diff --git a/packages/libs/jsonschema/package.json b/packages/libs/jsonschema/package.json index 1a0693669..8996429ef 100644 --- a/packages/libs/jsonschema/package.json +++ b/packages/libs/jsonschema/package.json @@ -36,6 +36,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "rimraf": "^3.0.2", diff --git a/packages/libs/oai2-to-oai3/package.json b/packages/libs/oai2-to-oai3/package.json index 299a2fea0..3818b355e 100644 --- a/packages/libs/oai2-to-oai3/package.json +++ b/packages/libs/oai2-to-oai3/package.json @@ -46,6 +46,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "rimraf": "^3.0.2", diff --git a/packages/libs/oai2-to-oai3/src/converter.ts b/packages/libs/oai2-to-oai3/src/converter.ts index b123d1c59..c680cc660 100644 --- a/packages/libs/oai2-to-oai3/src/converter.ts +++ b/packages/libs/oai2-to-oai3/src/converter.ts @@ -11,6 +11,7 @@ import { createMappingTree, } from "@azure-tools/datastore"; import { JsonPointer, getFromJsonPointer, appendJsonPointer } from "@azure-tools/json"; +import oai3, { EncodingStyle, HttpOperation, JsonType, PathItem, SecurityType } from "@azure-tools/openapi"; import { resolveOperationConsumes, resolveOperationProduces } from "./content-type-utils"; import { OpenAPI2Document, @@ -25,7 +26,6 @@ import { import { cleanElementName, convertOai2RefToOai3, parseOai2Ref } from "./refs-utils"; import { ResolveReferenceFn } from "./runner"; import { statusCodes } from "./status-codes"; -import oai3, { EncodingStyle, HttpOperation, JsonType, PathItem, SecurityType } from "@azure-tools/openapi"; // NOTE: after testing references should be changed to OpenAPI 3.x.x references diff --git a/packages/libs/oai2-to-oai3/test/conversion.test.ts b/packages/libs/oai2-to-oai3/test/conversion.test.ts index 866c30f83..2ba0b7443 100644 --- a/packages/libs/oai2-to-oai3/test/conversion.test.ts +++ b/packages/libs/oai2-to-oai3/test/conversion.test.ts @@ -1,8 +1,8 @@ +import fs from "fs"; +import { join } from "path"; import * as datastore from "@azure-tools/datastore"; import { ConverterLogger, Oai2ToOai3 } from "../src/converter"; import { OpenAPI2Document } from "../src/oai2"; -import { join } from "path"; -import fs from "fs"; const logger: ConverterLogger = { trackError: jest.fn(), diff --git a/packages/libs/oai2-to-oai3/test/scenarios/scenarios.test.ts b/packages/libs/oai2-to-oai3/test/scenarios/scenarios.test.ts index 66f62a55b..3b7db2ad8 100644 --- a/packages/libs/oai2-to-oai3/test/scenarios/scenarios.test.ts +++ b/packages/libs/oai2-to-oai3/test/scenarios/scenarios.test.ts @@ -1,6 +1,6 @@ -import { serializeJsonPointer } from "@azure-tools/json"; import fs from "fs"; import { basename, join } from "path"; +import { serializeJsonPointer } from "@azure-tools/json"; import { ConverterLogger, convertOai2ToOai3, OaiToOai3FileInput } from "../../src"; const inputsFolder = `${__dirname}/inputs/`; diff --git a/packages/libs/openapi/package.json b/packages/libs/openapi/package.json index 7ac8b03e6..ace3e42a0 100644 --- a/packages/libs/openapi/package.json +++ b/packages/libs/openapi/package.json @@ -44,6 +44,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "rimraf": "^3.0.2", diff --git a/packages/libs/yaml/package.json b/packages/libs/yaml/package.json index e1a55b40a..b2f2e4143 100644 --- a/packages/libs/yaml/package.json +++ b/packages/libs/yaml/package.json @@ -38,6 +38,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "jest": "^27.0.4", "rimraf": "^3.0.2", diff --git a/packages/libs/yaml/src/parser.ts b/packages/libs/yaml/src/parser.ts index 677a490d3..7dc55db82 100644 --- a/packages/libs/yaml/src/parser.ts +++ b/packages/libs/yaml/src/parser.ts @@ -6,8 +6,8 @@ // TODO: the following is only required because safeDump of "yaml-ast-parser" has this bug: https://github.com/mulesoft-labs/yaml-ast-parser/issues/30 // PLEASE: remove the entire dependency to js-yaml once that is fixed! import { dump, load } from "js-yaml"; -import { newMapping, safeLoad } from "yaml-ast-parser"; import { cloneDeep } from "lodash"; +import { newMapping, safeLoad } from "yaml-ast-parser"; import { YamlMap, YamlNode, YamlScalar, Kind, YamlSequence } from "./types"; export interface YamlNodeWithPath { diff --git a/packages/testing/test-public-packages/package.json b/packages/testing/test-public-packages/package.json index 29de12bf4..9c060af95 100644 --- a/packages/testing/test-public-packages/package.json +++ b/packages/testing/test-public-packages/package.json @@ -39,6 +39,7 @@ "@types/source-map-support": "^0.5.3", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "rimraf": "^3.0.2" } diff --git a/packages/testing/test-public-packages/src/index.ts b/packages/testing/test-public-packages/src/index.ts index 00010f90a..3cc4fd098 100644 --- a/packages/testing/test-public-packages/src/index.ts +++ b/packages/testing/test-public-packages/src/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/export */ import "source-map-support/register"; export * from "./test-autorest"; diff --git a/packages/testing/test-public-packages/src/test-autorest-core.ts b/packages/testing/test-public-packages/src/test-autorest-core.ts index 2bdcd3c9b..8df476080 100644 --- a/packages/testing/test-public-packages/src/test-autorest-core.ts +++ b/packages/testing/test-public-packages/src/test-autorest-core.ts @@ -1,4 +1,4 @@ -import * as AutorestCore from "@autorest/core"; import assert from "assert"; +import * as AutorestCore from "@autorest/core"; assert(AutorestCore.AutoRest); diff --git a/packages/testing/test-public-packages/src/test-autorest.ts b/packages/testing/test-public-packages/src/test-autorest.ts index 3bfe0be86..021344845 100644 --- a/packages/testing/test-public-packages/src/test-autorest.ts +++ b/packages/testing/test-public-packages/src/test-autorest.ts @@ -1,4 +1,4 @@ -import * as AutorestCli from "autorest"; import assert from "assert"; +import * as AutorestCli from "autorest"; assert(AutorestCli.AutoRest); diff --git a/packages/testing/test-utils/package.json b/packages/testing/test-utils/package.json index f735737a6..1922520e2 100644 --- a/packages/testing/test-utils/package.json +++ b/packages/testing/test-utils/package.json @@ -41,6 +41,7 @@ "@types/jest": "^26.0.20", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "rimraf": "^3.0.2" } diff --git a/packages/testing/test-utils/src/matchers/file-snapshot.ts b/packages/testing/test-utils/src/matchers/file-snapshot.ts index d260e9ad4..5ce53cf9c 100644 --- a/packages/testing/test-utils/src/matchers/file-snapshot.ts +++ b/packages/testing/test-utils/src/matchers/file-snapshot.ts @@ -1,7 +1,7 @@ -import { MatcherState } from "expect"; import * as fs from "fs"; -import SnapshotState from "jest-snapshot/build/State"; import * as path from "path"; +import { MatcherState } from "expect"; +import SnapshotState from "jest-snapshot/build/State"; declare global { namespace jest { diff --git a/packages/tools/compare/package.json b/packages/tools/compare/package.json index d1100a94f..80497f1a5 100644 --- a/packages/tools/compare/package.json +++ b/packages/tools/compare/package.json @@ -53,6 +53,7 @@ "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", + "eslint-plugin-import": "~2.24.2", "eslint": "^7.17.0", "mocha": "^6.2.2", "ts-mocha": "^6.0.0", diff --git a/packages/tools/compare/src/cli.ts b/packages/tools/compare/src/cli.ts index 0215003fc..c00cfdff3 100644 --- a/packages/tools/compare/src/cli.ts +++ b/packages/tools/compare/src/cli.ts @@ -4,7 +4,6 @@ import fs from "fs"; import path from "path"; import chalk from "chalk"; -import { AutoRestLanguages, AutoRestLanguage } from "./runner"; import { RunConfiguration, loadConfiguration, @@ -13,6 +12,7 @@ import { UseExistingOutput, } from "./config"; import { CompareOperation, BaselineOperation, Operation } from "./operations"; +import { AutoRestLanguages, AutoRestLanguage } from "./runner"; /** * Parses an argument of one of the following forms and returns the argument and diff --git a/packages/tools/compare/src/comparers.ts b/packages/tools/compare/src/comparers.ts index aea9dc202..37fc4f188 100644 --- a/packages/tools/compare/src/comparers.ts +++ b/packages/tools/compare/src/comparers.ts @@ -2,8 +2,8 @@ // Licensed under the MIT License. import path from "path"; -import { AutoRestGenerateResult } from "./runner"; import * as Diff from "diff"; +import { AutoRestGenerateResult } from "./runner"; /** * A function which compares two items and returns a CompareResult. diff --git a/packages/tools/compare/src/index.ts b/packages/tools/compare/src/index.ts index b88783da7..160769a82 100644 --- a/packages/tools/compare/src/index.ts +++ b/packages/tools/compare/src/index.ts @@ -3,9 +3,9 @@ // Licensed under the MIT License. import "source-map-support/register"; +import { getOperationFromArgs } from "./cli"; import { runOperation } from "./operations"; import { AutoRestLanguages } from "./runner"; -import { getOperationFromArgs } from "./cli"; async function main(): Promise { const args = process.argv.slice(2); diff --git a/packages/tools/compare/src/operations.ts b/packages/tools/compare/src/operations.ts index 7b93fdbf6..52ec9adbe 100644 --- a/packages/tools/compare/src/operations.ts +++ b/packages/tools/compare/src/operations.ts @@ -4,12 +4,12 @@ import fs from "fs"; import path from "path"; import chalk from "chalk"; -import { RunConfiguration, LanguageConfiguration } from "./config"; -import { generateWithAutoRest, AutoRestGenerateResult, getBaseResult, runAutoRest } from "./runner"; import { compareOutputFiles, CompareResult } from "./comparers"; -import { compareFile as compareTypeScriptFile } from "./languages/typescript"; +import { RunConfiguration, LanguageConfiguration } from "./config"; import { compareFile as comparePythonFile } from "./languages/python"; +import { compareFile as compareTypeScriptFile } from "./languages/typescript"; import { printCompareMessage } from "./printer"; +import { generateWithAutoRest, AutoRestGenerateResult, getBaseResult, runAutoRest } from "./runner"; export abstract class Operation { abstract runForSpec(languageConfig: LanguageConfiguration, specPath: string, debug: boolean): Promise; diff --git a/packages/tools/compare/src/runner.ts b/packages/tools/compare/src/runner.ts index a33873be3..b82b80c58 100644 --- a/packages/tools/compare/src/runner.ts +++ b/packages/tools/compare/src/runner.ts @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import * as path from "path"; import * as cp from "child_process"; -import { getPathsRecursively } from "./util"; -import { parseArgument } from "./cli"; import * as os from "os"; +import * as path from "path"; +import { parseArgument } from "./cli"; +import { getPathsRecursively } from "./util"; /** * Details for the output of an AutoRest run (pre-existing or not). diff --git a/packages/tools/md-mock-api/.eslintrc.yaml b/packages/tools/md-mock-api/.eslintrc.yaml index 3dd212905..e2e922099 100644 --- a/packages/tools/md-mock-api/.eslintrc.yaml +++ b/packages/tools/md-mock-api/.eslintrc.yaml @@ -1,21 +1,3 @@ -parser: "@typescript-eslint/parser" -extends: - - "../../../.default-eslintrc.yaml" - -plugins: - - import - -rules: - no-console: warn - - "@typescript-eslint/no-empty-interface": off - "@typescript-eslint/no-unused-vars": off - import/no-default-export: warn - import/no-self-import: warn # This cause many circular dependency issues with index files. - import/no-internal-modules: off - import/order: - - warn - - groups: ["builtin", "external", "parent", "sibling", "index"] - alphabetize: - order: "asc" - caseInsensitive: true +parser: "@typescript-eslint/parser" +extends: + - "../../../.default-eslintrc.yaml" diff --git a/packages/tools/md-mock-api/package.json b/packages/tools/md-mock-api/package.json index dce68d5f1..50fec841e 100644 --- a/packages/tools/md-mock-api/package.json +++ b/packages/tools/md-mock-api/package.json @@ -11,7 +11,7 @@ "node": ">=12.0.0" }, "scripts": { - "lint:fix": "eslint . --fix --ext .ts", + "lint:fix": "eslint ./src --fix --ext .ts", "lint": "eslint ./src --ext .ts --max-warnings=0", "test": "jest --watchAll --coverage=false", "test:ci": "jest --ci", @@ -38,7 +38,7 @@ "eslint": "^7.17.0", "eslint-plugin-jest": "~24.3.2", "eslint-plugin-node": "~11.1.0", - "eslint-plugin-import": "~2.22.1", + "eslint-plugin-import": "~2.24.2", "eslint-plugin-prettier": "~3.4.0", "eslint-plugin-unicorn": "~33.0.1", "prettier": "~2.3.1",