From a97cdc4cd9c782ec4f8f67d1c0cdb5a93ec04094 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 28 Aug 2023 11:12:26 +0200 Subject: [PATCH] Ensure no extension is defined in .ts files --- .eslintrc.yaml | 92 ++++++++++++++++++++++++++--------------------- package-lock.json | 60 +++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 112 insertions(+), 41 deletions(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index edc573b98..c135abae7 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -1,42 +1,52 @@ -{ - root: true, - extends: [ - 'openlayers', - '.eslintrc-es6.yaml' - ], - rules: { - no-console: 0, - comma-dangle: 0, - no-extra-boolean-cast: 0, - brace-style: 0, - prefer-template: 0, - no-multiple-empty-lines: 0, - valid-jsdoc: 0, - indent: [2, 2, { - VariableDeclarator: 2, - SwitchCase: 1, - MemberExpression: 2, - FunctionDeclaration: { - parameters: 2, - body: 1 - }, - FunctionExpression: { - parameters: 2, - body: 1 - }, - CallExpression: { - arguments: 2 - } +root: true +extends: + - openlayers + - .eslintrc-es6.yaml + - plugin:import/recommended + - plugin:import/typescript +settings: + import/resolver: + # You will also need to install and configure the TypeScript resolver + # See also https://github.com/import-js/eslint-import-resolver-typescript#configuration + typescript: true + node: true +rules: + no-console: 0 + comma-dangle: 0 + no-extra-boolean-cast: 0 + brace-style: 0 + prefer-template: 0 + no-multiple-empty-lines: 0 + valid-jsdoc: 0 + indent: [2, 2, { + VariableDeclarator: 2, + SwitchCase: 1, + MemberExpression: 2, + FunctionDeclaration: { + parameters: 2, + body: 1 + }, + FunctionExpression: { + parameters: 2, + body: 1 + }, + CallExpression: { + arguments: 2 + } }] - }, - overrides: [{ - "files": [ "examples/*.js" ], - "rules": { - "import/no-unresolved": 0 - } -}], - globals: { - webpack: false, - Cesium: false - } -} +overrides: + - files: [ "examples/*.js" ] + rules: + import/no-unresolved: 0 + - files: ['*.ts'] + rules: + import/extensions: [ + "error", + { + "ts": "never", + "js": "always" + } + ] +globals: + webpack: false + Cesium: false diff --git a/package-lock.json b/package-lock.json index 2d3b2b322..2196ccbe7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "cross-env": "7.0.3", "eslint": "8.48.0", "eslint-config-openlayers": "12.0.0", + "eslint-import-resolver-typescript": "^3.6.0", "eslint-import-resolver-webpack": "0.13.7", "eslint-plugin-import": "^2.28.0", "html-loader": "4.2.0", @@ -4476,6 +4477,44 @@ "ms": "^2.1.1" } }, + "node_modules/eslint-import-resolver-typescript": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.0.tgz", + "integrity": "sha512-QTHR9ddNnn35RTxlaEnx2gCxqFlF2SEN0SE2d17SqwyM7YOSI2GHWRYp5BiRkObTUNYPupC/3Fq2a0PpT+EKpg==", + "dev": true, + "dependencies": { + "debug": "^4.3.4", + "enhanced-resolve": "^5.12.0", + "eslint-module-utils": "^2.7.4", + "fast-glob": "^3.3.1", + "get-tsconfig": "^4.5.0", + "is-core-module": "^2.11.0", + "is-glob": "^4.0.3" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts/projects/eslint-import-resolver-ts" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*" + } + }, + "node_modules/eslint-import-resolver-typescript/node_modules/enhanced-resolve": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", + "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/eslint-import-resolver-webpack": { "version": "0.13.7", "resolved": "https://registry.npmjs.org/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.13.7.tgz", @@ -5287,6 +5326,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-tsconfig": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.0.tgz", + "integrity": "sha512-pmjiZ7xtB8URYm74PlGJozDNyhvsVLUcpBa8DZBG3bWHwaHa9bPiRpiSfovw+fjhwONSCWKRyk+JQHEGZmMrzw==", + "dev": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -7980,6 +8031,15 @@ "node": ">=4" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/resolve-protobuf-schema": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz", diff --git a/package.json b/package.json index d3795b701..0f0c3ee5d 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "cross-env": "7.0.3", "eslint": "8.48.0", "eslint-config-openlayers": "12.0.0", + "eslint-import-resolver-typescript": "^3.6.0", "eslint-import-resolver-webpack": "0.13.7", "eslint-plugin-import": "^2.28.0", "html-loader": "4.2.0",