2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-22 09:48:54 +00:00

chore(iconify-icon): update dependencies, migrate to new eslint

This commit is contained in:
Vjacheslav Trushkin 2024-11-01 17:23:30 +02:00
parent 68ac4aba7e
commit b24608182b
8 changed files with 60 additions and 47 deletions

View File

@ -1,3 +0,0 @@
lib
dist
tests-compiled

View File

@ -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'],
},
],
};

View File

@ -1,6 +1,6 @@
.DS_Store
.eslintignore
.eslintrc.js
eslint.config.*
api-extractor*.json
tsconfig*.json
rollup.config.js

View File

@ -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"],
}];

View File

@ -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"
}
}

View File

@ -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) {
//
}

View File

@ -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);

View File

@ -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 = '<span inline="true" height="1em"></span>';
// Test height
node.innerHTML = '<span height="1em"></span>';
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 = '<span flip="horizontal" rotate="2"></span>';
@ -53,7 +50,6 @@ describe('Testing customisations', () => {
true
);
expect(haveCustomisationsChanged(test1, test2)).toBe(true);
expect(getInline(testNode)).toBe(false);
// Dimensions, empty value
node.innerHTML = '<span width="auto" height=""></span>';
@ -69,7 +65,6 @@ describe('Testing customisations', () => {
expect(haveCustomisationsChanged(test3, emptyCustomisations)).toBe(
true
);
expect(getInline(testNode)).toBe(false);
// preserveAspectRatio
node.innerHTML = '<span preserveAspectRatio="xMidYMid meet"></span>';