Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency eslint to v9 (master) #9440

Merged
merged 10 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 0 additions & 76 deletions .eslintrc.yaml

This file was deleted.

23 changes: 14 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ GMF_EXAMPLES_JS_FILES := $(GMF_EXAMPLES_HTML_FILES:.html=.js)

GMF_APPS += mobile desktop desktop_alt iframe_api mobile_alt oeedit
GMF_APPS_JS_FILES = $(shell find contribs/gmf/apps/ -type f -name '*.js') $(shell find contribs/gmf/apps/ -type f -name '*.ts')
BUILD_JS_FILES = $(shell ls -1 *.js) $(shell ls -1 utils/*.js) $(shell find buildtools/ -type f -name '*.js') $(shell find .storybook/ -type f -name '*.js') $(shell find cypress/ -type f -name '*.js')
BUILD_JS_FILES = $(shell ls -1 *.js) $(shell ls -1 utils/*.js) $(shell find buildtools/ -type f -name '*.js') $(shell find cypress/ -type f -name '*.js')
GMF_APPS_PARTIALS_FILES = $(shell find contribs/gmf/apps/ -type f -name '*.html' -or -name '*.html.ejs')
GMF_APPS_ALL_FILES = $(shell find contribs/gmf/apps/ -type f) $(NGEO_ALL_SRC_FILES)

Expand Down Expand Up @@ -199,33 +199,38 @@ examples-hosted-apps: .build/gmf-apps.timestamp
npm run build-gmf-apps
touch $@

.build/eslint.timestamp: .eslintrc.yaml \
.build/eslint.timestamp: eslint.config.mjs .build/eslint.test.timestamp \
$(API_JS_FILES) \
$(NGEO_JS_FILES) \
$(NGEO_TEST_JS_FILES) \
$(NGEO_EXAMPLES_JS_FILES) \
$(GMF_TEST_JS_FILES) \
$(GMF_EXAMPLES_JS_FILES) \
$(GMF_APPS_JS_FILES) \
$(BUILD_JS_FILES)
./node_modules/.bin/eslint $(filter-out .eslintrc.yaml, $^)
./node_modules/.bin/eslint $(filter-out eslint.config.mjs .build/eslint.test.timestamp, $^)
touch $@


.build/eslint.test.timestamp: test/eslint.config.mjs \
$(NGEO_TEST_JS_FILES) \
$(GMF_TEST_JS_FILES)
./node_modules/.bin/eslint --config=test/eslint.config.mjs $(filter-out test/eslint.config.mjs, $^)
touch $@

.build/eslint-ts.timestamp: .eslintrc.yaml \
.build/eslint-ts.timestamp: eslint.config.mjs \
$(TS_FILES)
./node_modules/.bin/eslint --max-warnings=0 $(filter-out .eslintrc.yaml .eslintrc-ts.yaml, $^)
./node_modules/.bin/eslint --max-warnings=0 $(filter-out eslint.config.mjs .eslintrc-ts.yaml, $^)
touch $@

.PHONY: eslint-fix
eslint-fix: .eslintrc.yaml \
eslint-fix: eslint.config.mjs \
$(API_JS_FILES) \
$(NGEO_JS_FILES) \
$(NGEO_TEST_JS_FILES) \
$(NGEO_EXAMPLES_JS_FILES) \
$(GMF_EXAMPLES_JS_FILES) \
$(GMF_APPS_JS_FILES) \
$(BUILD_JS_FILES)
./node_modules/.bin/eslint --fix $(filter-out .eslintrc.yaml, $^)
./node_modules/.bin/eslint --fix $(filter-out eslint.config.mjs, $^)

.build/examples-hosted/partials: examples/partials/
mkdir -p $(dir $@)
Expand Down
2 changes: 0 additions & 2 deletions contribs/gmf/test/.eslintrc.yaml

This file was deleted.

100 changes: 100 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import js from '@eslint/js';
import {FlatCompat} from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
...compat.extends(
'eslint:recommended',
'plugin:jsdoc/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:wc/recommended',
'plugin:lit/recommended',
),
{
plugins: {
'@typescript-eslint': typescriptEslint,
},

languageOptions: {
globals: {
...globals.node,
...globals.browser,
...globals.jquery,
},

parser: tsParser,
ecmaVersion: 2020,
sourceType: 'module',

parserOptions: {
project: ['tsconfig-eslint.json'],
},
},

settings: {
jsdoc: {
preferredTypes: {
'[]': null,
'Array<>': '[]',
},
},
},

rules: {
'no-multi-asterisks': 'off',
'no-prototype-builtins': 'warn',
'no-case-declarations': 'warn',
'no-eq-null': 'error',
'no-multi-assign': 'error',
'no-negated-in-lhs': 'error',
'no-use-before-define': ['error', 'nofunc'],
'no-var': 'error',
'jsdoc/require-param-type': 'off',
'jsdoc/require-property-type': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/check-tag-names': 'warn',
'jsdoc/check-types': 'off',
'jsdoc/no-undefined-types': 'warn',
'jsdoc/require-returns-description': 'warn',
'jsdoc/require-param-description': 'warn',
'jsdoc/require-property-description': 'warn',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/unbound-method': 'warn',
'@typescript-eslint/restrict-template-expressions': 'warn',
'@typescript-eslint/no-misused-promises': 'warn',
'@typescript-eslint/require-await': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/prefer-promise-reject-errors': 'warn',
'@typescript-eslint/no-require-imports': 'warn',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
},
},
];
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,20 @@
},
"devDependencies": {
"@babel/core": "7.25.2",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
"@babel/plugin-proposal-optional-chaining": "7.21.0",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-proposal-decorators": "7.24.7",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
"@babel/plugin-proposal-optional-chaining": "7.21.0",
"@babel/plugin-syntax-object-rest-spread": "7.8.3",
"@babel/plugin-transform-spread": "7.24.7",
"@babel/plugin-transform-typescript": "7.25.2",
"@babel/preset-env": "7.25.3",
"@babel/preset-typescript": "7.24.7",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.9.1",
"@fortawesome/fontawesome-free": "5.15.4",
"@lit/reactive-element": "1.6.3",
"@popperjs/core": "2.11.8",
"@sentry/browser": "7.118.0",
"@sentry/tracing": "7.114.0",
"@sentry/types": "7.118.0",
Expand Down Expand Up @@ -131,7 +134,7 @@
"doctrine": "3.0.0",
"editorconfig-checker": "5.1.8",
"ejs-loader": "0.5.0",
"eslint": "8.57.0",
"eslint": "9.9.1",
"eslint-plugin-jsdoc": "50.2.2",
"eslint-plugin-lit": "1.14.0",
"eslint-plugin-wc": "2.1.1",
Expand All @@ -144,6 +147,7 @@
"floatthead": "2.2.5",
"fs-extra": "11.2.0",
"glob": "11.0.0",
"globals": "15.9.0",
"html-webpack-plugin": "4.5.2",
"i18next": "23.14.0",
"i18next-browser-languagedetector": "8.0.0",
Expand Down Expand Up @@ -179,7 +183,6 @@
"ol-layerswitcher": "4.1.2",
"ol-mapbox-style": "12.3.5",
"parse-absolute-css-unit": "1.0.2",
"@popperjs/core": "2.11.8",
"proj4": "2.11.0",
"puppeteer": "20.9.0",
"qruri": "0.0.4",
Expand Down
4 changes: 2 additions & 2 deletions src/auth/FormElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,9 @@ export default class GmfAuthForm extends GmfBaseElement {
*/
cleanForm_(): void {
const form = this.renderRoot.querySelector('form') as HTMLFormElement;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion

const loginField = document.body.querySelector('input[slot=gmf-auth-login]') as HTMLInputElement;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion

const passwordField = document.body.querySelector('input[slot=gmf-auth-password]') as HTMLInputElement;
form.reset();
loginField.value = '';
Expand Down
3 changes: 0 additions & 3 deletions src/auth/component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ describe('Auth component', () => {
} as Configuration);
});

// eslint-disable-next-line @typescript-eslint/no-misused-promises
it.skip('tries to login with wrong credentials', async () => {
gmfAuthenticationService.load_();
expect(user.getState()).to.equal(UserState.NOT_INITIALIZED);
Expand All @@ -81,7 +80,6 @@ describe('Auth component', () => {
});
});

// eslint-disable-next-line @typescript-eslint/no-misused-promises
it.skip('logins successfully', async () => {
gmfAuthenticationService.load_();
expect(user.getState()).to.equal(UserState.READY);
Expand All @@ -95,7 +93,6 @@ describe('Auth component', () => {
});
});

// eslint-disable-next-line @typescript-eslint/no-misused-promises
it.skip('logs out', async () => {
expect(user.getState()).to.equal(UserState.LOGGED_IN);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Expand Down
1 change: 0 additions & 1 deletion src/auth/component.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */

import './FormElement';
import './PanelElement';
Expand Down
1 change: 0 additions & 1 deletion src/canvas/Desktop.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */

import ToolButtonElement, {ToolButtonDefault} from 'gmfapi/elements/ToolButtonElement';
import {css, html, TemplateResult} from 'lit';
Expand Down
1 change: 0 additions & 1 deletion src/download/Csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export class DownloadCsvService {

const rowValues = values.map((value) => {
if (value !== undefined && value !== null) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
const strValue = `${value}`;
// wrap each value into quotes and escape quotes with double quotes
return `${this.quote_}${strValue.replace(matchAllQuotesRegex, doubleQuote)}${this.quote_}`;
Expand Down
7 changes: 2 additions & 5 deletions src/e2e/desktop.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@

/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/unbound-method */

import olMap from 'ol/Map';
import path from 'path';
Expand Down Expand Up @@ -251,9 +248,9 @@ if (Cypress.browser.isHeaded) {
*/
function validateCsv(csv: string, validationObject: any) {
cy.wrap(csv)
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument

.then(stripBom) // Remove Byte order mark
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument

.then(neatCSV) // Parse the CSV
.then((list: any) => {
expect(list, 'number of records').to.have.length(1);
Expand Down
2 changes: 1 addition & 1 deletion src/lidar/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ export class LidarprofileManager {
this.profilePoints.altitude.push(z);
this.profilePoints.coords.push([x, y]);
}
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands

aoffset = aoffset + attribute.bytes;
}
}
Expand Down
Loading
Loading