diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fe1250ce7fd9..28efbca98471 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -57,6 +57,17 @@ repos: |\.prettierignore |examples/svg\.html )$ + - repo: https://github.com/editorconfig-checker/editorconfig-checker.python + rev: 3.0.3 + hooks: + - id: editorconfig-checker + args: + - -disable-indentation + - -disable-max-line-length + exclude: |- + (?x)^( + secrets\.tar\.enc + )$ - repo: https://github.com/shellcheck-py/shellcheck-py rev: v0.10.0.1 hooks: diff --git a/Makefile b/Makefile index ca9e25c4e021..fb80b2cf7b23 100644 --- a/Makefile +++ b/Makefile @@ -117,7 +117,7 @@ check-examples-checker: $(CHECK_EXAMPLE_CHECKER) check-examples: $(BUILD_EXAMPLES_CHECK_TIMESTAMP_FILES) .PHONY: lint -lint: .build/eslint.timestamp .build/eslint-ts.timestamp eclint lint-extra +lint: .build/eslint.timestamp .build/eslint-ts.timestamp lint-extra .PHONY: lint-extra lint-extra: @@ -127,10 +127,6 @@ lint-extra: .PHONY: eslint eslint: .build/eslint.timestamp .build/eslint-ts.timestamp -.PHONY: eclint -eclint: .build/node_modules.timestamp - npm run eclint - .PHONY: test test: .build/node_modules.timestamp .build/build-dll.timestamp TS_NODE_PROJECT=disable.json ./node_modules/karma/bin/karma start karma-conf.js --single-run diff --git a/buildtools/webpack.commons.js b/buildtools/webpack.commons.js index 747a4a842234..90a625733447 100644 --- a/buildtools/webpack.commons.js +++ b/buildtools/webpack.commons.js @@ -47,8 +47,10 @@ module.exports = function (config) { $: 'jquery', }); + const rules = []; + // Expose corejs-typeahead as window.Bloodhound - const typeaheadRule = { + rules.push({ test: require.resolve('corejs-typeahead'), use: { loader: 'expose-loader', @@ -56,9 +58,9 @@ module.exports = function (config) { exposes: 'Bloodhound', }, }, - }; + }); - const jqueryRule = { + rules.push({ test: require.resolve('jquery'), use: { loader: 'expose-loader', @@ -66,9 +68,9 @@ module.exports = function (config) { exposes: '$', }, }, - }; + }); - const gmfapiExpose = { + rules.push({ test: path.resolve(__dirname, '../srcapi/index.ts'), use: { loader: 'expose-loader', @@ -79,49 +81,28 @@ module.exports = function (config) { }, }, }, - }; - - const jsRule = { - test: /MapillaryService\.js$/, - use: [ - { - loader: 'magic-comments-loader', - }, - ], - }; - - const tsRule = { - test: /\.tsx?$/, - use: [ - { - loader: 'ts-loader', - }, - { - loader: 'minify-html-literals-loader', - }, - ], - }; + }); - const cssRule = { + rules.push({ test: /\.css$/, use: [{loader: 'style-loader'}, {loader: 'css-loader'}], - }; + }); - const sassRule = { + rules.push({ test: /\.s[ac]ss$/i, use: [ {loader: 'style-loader'}, {loader: 'css-loader'}, {loader: 'sass-loader', options: {warnRuleAsWarning: false}}, ], - }; + }); - const resourcesRule = { + rules.push({ test: /\.(jpeg|png|ico|eot|ttf|woff|woff2|svg|json)$/, type: 'asset/resource', - }; + }); - const htmlRule = { + rules.push({ test: /\.html$/, use: { loader: 'ejs-loader', @@ -129,7 +110,30 @@ module.exports = function (config) { esModule: false, }, }, - }; + }); + + if (config.noTs != true) { + rules.push({ + test: /\.tsx?$/, + use: [ + { + loader: 'ts-loader', + }, + { + loader: 'minify-html-literals-loader', + }, + ], + }); + } + + rules.push({ + test: /MapillaryService\.js$/, + use: [ + { + loader: 'magic-comments-loader', + }, + ], + }); const plugins = [ providePlugin, @@ -155,17 +159,7 @@ module.exports = function (config) { path: path.resolve(__dirname, '../dist/'), }, module: { - rules: [ - typeaheadRule, - jqueryRule, - gmfapiExpose, - cssRule, - sassRule, - resourcesRule, - htmlRule, - tsRule, - jsRule, - ], + rules: rules, }, plugins: plugins, resolve: { diff --git a/package.json b/package.json index 15359307f732..cc26dd47c630 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ "build-gmf-examples": "TARGET=gmf-examples webpack --mode=development --progress", "build-gmf-apps": "TARGET=gmf-apps webpack --mode=development --progress", "build-api": "webpack --config buildtools/webpack.api.js --mode=production --progress", - "eclint": "editorconfig-checker -disable-indentation -disable-max-line-length --exclude secrets.tar.enc", "serve-ngeo-examples": "DEV_SERVER=1 TARGET=ngeo-examples webpack serve --open --server-type=https --server-options-cert=private.crt --server-options-key=private.key --port=3000 --mode=development --progress --watch", "serve-gmf-examples": "DEV_SERVER=1 TARGET=gmf-examples webpack serve --open --server-type=https --server-options-cert=private.crt --server-options-key=private.key --port=3000 --mode=development --progress --watch", "serve-gmf-apps": "DEV_SERVER=1 TARGET=gmf-apps webpack serve --open --server-type=https --server-options-cert=private.crt --server-options-key=private.key --port=3000 --mode=development --progress", @@ -61,7 +60,7 @@ }, "dependencies": { "@fortawesome/fontawesome-free": "5.15.4", - "@lit/reactive-element": "2.0.4", + "@sentry/browser": "8.29.0", "@trevoreyre/autocomplete-js": "3.0.2", "angular": "1.8.3", "angular-animate": "1.8.3", @@ -116,8 +115,6 @@ "@chromatic-com/storybook": "2.0.0", "@eslint/eslintrc": "3.1.0", "@eslint/js": "9.9.1", - "@popperjs/core": "2.11.8", - "@sentry/browser": "8.29.0", "@sentry/types": "8.29.0", "@storybook/addon-essentials": "8.2.9", "@storybook/addon-links": "8.2.9", @@ -154,7 +151,6 @@ "@typescript-eslint/eslint-plugin": "8.3.0", "@typescript-eslint/parser": "8.3.0", "angular-mocks": "1.8.3", - "chokidar": "3.6.0", "chromatic": "11.7.1", "commander": "12.1.0", "copy-webpack-plugin": "12.0.2", @@ -164,7 +160,6 @@ "cypress-browser-permissions": "1.1.0", "cypress-real-events": "1.13.0", "doctrine": "3.0.0", - "editorconfig-checker": "5.1.8", "ejs-loader": "0.5.0", "eslint": "9.9.1", "eslint-plugin-jsdoc": "50.2.2",