From b24608182baf078035c3bd841f7b3333f5ea0040 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Fri, 1 Nov 2024 17:23:30 +0200 Subject: [PATCH] chore(iconify-icon): update dependencies, migrate to new eslint --- iconify-icon/icon/.eslintignore | 3 -- iconify-icon/icon/.eslintrc.js | 24 ----------- iconify-icon/icon/.npmignore | 2 +- iconify-icon/icon/eslint.config.mjs | 41 +++++++++++++++++++ iconify-icon/icon/package.json | 25 ++++++----- iconify-icon/icon/src/attributes/mode.ts | 1 + iconify-icon/icon/src/tests/helpers.ts | 2 +- .../icon/tests/customisations-test.ts | 9 +--- 8 files changed, 60 insertions(+), 47 deletions(-) delete mode 100644 iconify-icon/icon/.eslintignore delete mode 100644 iconify-icon/icon/.eslintrc.js create mode 100644 iconify-icon/icon/eslint.config.mjs diff --git a/iconify-icon/icon/.eslintignore b/iconify-icon/icon/.eslintignore deleted file mode 100644 index a37fc0d..0000000 --- a/iconify-icon/icon/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -lib -dist -tests-compiled diff --git a/iconify-icon/icon/.eslintrc.js b/iconify-icon/icon/.eslintrc.js deleted file mode 100644 index d3b2729..0000000 --- a/iconify-icon/icon/.eslintrc.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = { - env: { - browser: true, - es6: true, - node: true, - }, - extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], - globals: { - Atomics: 'readonly', - SharedArrayBuffer: 'readonly', - }, - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - rules: { - 'no-mixed-spaces-and-tabs': ['off'], - 'no-unused-vars': ['off'], - // '@typescript-eslint/no-unused-vars-experimental': ['error'], - }, - overrides: [ - { - files: ['src/**/*.ts', 'tests/*.ts'], - }, - ], -}; diff --git a/iconify-icon/icon/.npmignore b/iconify-icon/icon/.npmignore index 19beb44..6f625b3 100644 --- a/iconify-icon/icon/.npmignore +++ b/iconify-icon/icon/.npmignore @@ -1,6 +1,6 @@ .DS_Store .eslintignore -.eslintrc.js +eslint.config.* api-extractor*.json tsconfig*.json rollup.config.js diff --git a/iconify-icon/icon/eslint.config.mjs b/iconify-icon/icon/eslint.config.mjs new file mode 100644 index 0000000..67fa8df --- /dev/null +++ b/iconify-icon/icon/eslint.config.mjs @@ -0,0 +1,41 @@ +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 [{ + ignores: ["**/lib", "**/dist", "**/tests-compiled"], +}, ...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"), { + plugins: { + "@typescript-eslint": typescriptEslint, + }, + + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + Atomics: "readonly", + SharedArrayBuffer: "readonly", + }, + + parser: tsParser, + }, + + rules: { + "no-mixed-spaces-and-tabs": ["off"], + "no-unused-vars": ["off"], + }, +}, { + files: ["src/**/*.ts", "tests/*.ts"], +}]; \ No newline at end of file diff --git a/iconify-icon/icon/package.json b/iconify-icon/icon/package.json index b1cab6d..dd7ae86 100644 --- a/iconify-icon/icon/package.json +++ b/iconify-icon/icon/package.json @@ -54,23 +54,26 @@ "@iconify/types": "workspace:^" }, "devDependencies": { + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.13.0", "@iconify/core": "workspace:^", "@iconify/utils": "workspace:^", - "@microsoft/api-extractor": "^7.47.2", - "@rollup/plugin-node-resolve": "^15.2.3", - "@rollup/plugin-replace": "^5.0.7", + "@microsoft/api-extractor": "^7.47.11", + "@rollup/plugin-node-resolve": "^15.3.0", + "@rollup/plugin-replace": "^6.0.1", "@rollup/plugin-terser": "^0.4.4", - "@types/jest": "^29.5.12", + "@types/jest": "^29.5.14", "@types/jsdom": "^21.1.7", - "@types/node": "^18.19.41", - "@typescript-eslint/eslint-plugin": "^6.21.0", + "@types/node": "^22.8.6", + "@typescript-eslint/eslint-plugin": "^8.12.2", "cross-env": "^7.0.3", - "eslint": "^8.57.0", + "eslint": "^9.13.0", + "globals": "^15.11.0", "jest": "^29.7.0", - "jsdom": "^22.1.0", + "jsdom": "^25.0.1", "rimraf": "^6.0.1", - "rollup": "^3.29.4", - "ts-jest": "^29.2.3", - "typescript": "^5.5.3" + "rollup": "^4.24.3", + "ts-jest": "^29.2.5", + "typescript": "^5.6.3" } } diff --git a/iconify-icon/icon/src/attributes/mode.ts b/iconify-icon/icon/src/attributes/mode.ts index b7d2c5c..df21eb2 100644 --- a/iconify-icon/icon/src/attributes/mode.ts +++ b/iconify-icon/icon/src/attributes/mode.ts @@ -4,6 +4,7 @@ import type { ActualRenderMode, IconifyRenderMode } from './types'; let isBuggedSafari = false; try { isBuggedSafari = navigator.vendor.indexOf('Apple') === 0; + // eslint-disable-next-line @typescript-eslint/no-unused-vars } catch (err) { // } diff --git a/iconify-icon/icon/src/tests/helpers.ts b/iconify-icon/icon/src/tests/helpers.ts index efe88b4..8968ebd 100644 --- a/iconify-icon/icon/src/tests/helpers.ts +++ b/iconify-icon/icon/src/tests/helpers.ts @@ -115,7 +115,7 @@ function getStyleValue(inline: boolean): string { return ( ':host{display:inline-block;vertical-align:' + (inline ? '-0.125em' : '0') + - '}span,svg{display:block}' + '}span,svg{display:block;margin:auto}' ); } export const expectedInline = getStyleValue(true); diff --git a/iconify-icon/icon/tests/customisations-test.ts b/iconify-icon/icon/tests/customisations-test.ts index 3bd7651..0153a0e 100644 --- a/iconify-icon/icon/tests/customisations-test.ts +++ b/iconify-icon/icon/tests/customisations-test.ts @@ -3,7 +3,6 @@ import { haveCustomisationsChanged, defaultCustomisations, } from '../src/attributes/customisations'; -import { getInline } from '../src/attributes/inline'; import { cleanupGlobals, setupDOM } from '../src/tests/helpers'; describe('Testing customisations', () => { @@ -17,7 +16,6 @@ describe('Testing customisations', () => { const node = doc.createElement('div'); const emptyCustomisations = getCustomisations(node); expect(emptyCustomisations).toEqual(defaultCustomisations); - expect(getInline(node)).toBe(false); expect( haveCustomisationsChanged( emptyCustomisations, @@ -25,8 +23,8 @@ describe('Testing customisations', () => { ) ).toBe(false); - // Test inline and height - node.innerHTML = ''; + // Test height + node.innerHTML = ''; let testNode = node.lastChild as HTMLSpanElement; const test1 = getCustomisations(testNode); @@ -37,7 +35,6 @@ describe('Testing customisations', () => { expect(haveCustomisationsChanged(emptyCustomisations, test1)).toBe( true ); - expect(getInline(testNode)).toBe(true); // Test transformations node.innerHTML = ''; @@ -53,7 +50,6 @@ describe('Testing customisations', () => { true ); expect(haveCustomisationsChanged(test1, test2)).toBe(true); - expect(getInline(testNode)).toBe(false); // Dimensions, empty value node.innerHTML = ''; @@ -69,7 +65,6 @@ describe('Testing customisations', () => { expect(haveCustomisationsChanged(test3, emptyCustomisations)).toBe( true ); - expect(getInline(testNode)).toBe(false); // preserveAspectRatio node.innerHTML = '';