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

chore(utils): update dependencies, migrate to new eslint

This commit is contained in:
Vjacheslav Trushkin 2024-11-01 17:08:23 +02:00
parent dead8fd6a6
commit e99de23453
14 changed files with 1800 additions and 505 deletions

View File

@ -1 +0,0 @@
lib

View File

@ -28,6 +28,8 @@
"directory": "packages/api-redundancy" "directory": "packages/api-redundancy"
}, },
"devDependencies": { "devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.13.0",
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/node": "^22.8.6", "@types/node": "^22.8.6",
"@typescript-eslint/eslint-plugin": "^8.12.2", "@typescript-eslint/eslint-plugin": "^8.12.2",

View File

@ -1 +0,0 @@
lib

View File

@ -1,33 +0,0 @@
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:prettier/recommended',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['tsconfig.json', 'tests/tsconfig.json'],
extraFileExtensions: ['.cjs'],
},
plugins: ['@typescript-eslint'],
rules: {
'no-mixed-spaces-and-tabs': ['off'],
'no-unused-vars': ['off'],
},
overrides: [
{
files: ['src/**/*.ts', 'tests/*.ts'],
},
],
};

View File

@ -7,7 +7,7 @@ node_modules
npm-debug.log npm-debug.log
yarn.lock yarn.lock
tsconfig.tsbuildinfo tsconfig.tsbuildinfo
.eslintrc.cjs eslint.config.*
tsconfig.json tsconfig.json
tsconfig.common.json tsconfig.common.json
jest.config.* jest.config.*

View File

@ -0,0 +1,54 @@
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"],
}, ...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:prettier/recommended",
), {
plugins: {
"@typescript-eslint": typescriptEslint,
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
Atomics: "readonly",
SharedArrayBuffer: "readonly",
},
parser: tsParser,
ecmaVersion: 5,
sourceType: "commonjs",
parserOptions: {
tsconfigRootDir: "/Users/slava/Documents/dev/iconify/iconify/iconify-dev/packages/utils",
project: ["tsconfig.json", "tests/tsconfig.json"],
extraFileExtensions: [".cjs"],
},
},
rules: {
"no-mixed-spaces-and-tabs": ["off"],
"no-unused-vars": ["off"],
},
}, {
files: ["src/**/*.ts", "tests/*.ts"],
}];

View File

@ -418,27 +418,30 @@
"*.d.ts" "*.d.ts"
], ],
"dependencies": { "dependencies": {
"@antfu/install-pkg": "^0.4.0", "@antfu/install-pkg": "^0.4.1",
"@antfu/utils": "^0.7.10", "@antfu/utils": "^0.7.10",
"@iconify/types": "workspace:^", "@iconify/types": "workspace:^",
"debug": "^4.3.6", "debug": "^4.3.7",
"globals": "^15.11.0",
"kolorist": "^1.8.0", "kolorist": "^1.8.0",
"local-pkg": "^0.5.0", "local-pkg": "^0.5.0",
"mlly": "^1.7.1" "mlly": "^1.7.2"
}, },
"devDependencies": { "devDependencies": {
"@iconify-json/fa6-regular": "^1.1.22", "@eslint/eslintrc": "^3.1.0",
"@iconify-json/flat-color-icons": "^1.1.11", "@eslint/js": "^9.13.0",
"@iconify-json/fa6-regular": "^1.2.1",
"@iconify-json/flat-color-icons": "^1.2.0",
"@types/debug": "^4.1.12", "@types/debug": "^4.1.12",
"@types/jest": "^29.5.12", "@types/jest": "^29.5.14",
"@types/node": "^18.19.45", "@types/node": "^18.19.63",
"@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/eslint-plugin": "^8.12.2",
"eslint": "^8.57.0", "eslint": "^9.13.0",
"eslint-config-prettier": "^8.10.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1", "eslint-plugin-prettier": "^5.2.1",
"rimraf": "^6.0.1", "rimraf": "^6.0.1",
"typescript": "^5.5.4", "typescript": "^5.6.3",
"unbuild": "^1.2.1", "unbuild": "^2.0.0",
"vitest": "^0.34.6" "vitest": "^2.1.4"
} }
} }

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import type { IconifyJSON } from '@iconify/types'; import type { IconifyJSON } from '@iconify/types';
import { defaultIconDimensions } from '../icon/defaults'; import { defaultIconDimensions } from '../icon/defaults';

View File

@ -100,6 +100,7 @@ export async function loadCollectionFromFS(
let stat: Stats | undefined; let stat: Stats | undefined;
try { try {
stat = jsonPath ? await fs.lstat(jsonPath) : undefined; stat = jsonPath ? await fs.lstat(jsonPath) : undefined;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) { } catch (err) {
return undefined; return undefined;
} }

View File

@ -16,7 +16,6 @@ export async function tryInstallPkg(
} }
if (!tasks[name]) { if (!tasks[name]) {
// eslint-disable-next-line no-console
console.log(cyan(`Installing ${name}...`)); console.log(cyan(`Installing ${name}...`));
if (typeof autoInstall === 'function') { if (typeof autoInstall === 'function') {
tasks[name] = pending = autoInstall(name) tasks[name] = pending = autoInstall(name)

View File

@ -21,6 +21,7 @@ export function FileSystemIconLoader(
for (const path of paths) { for (const path of paths) {
try { try {
stat = await fs.lstat(path); stat = await fs.lstat(path);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) { } catch (err) {
continue; continue;
} }

View File

@ -16,6 +16,7 @@ function createPolicy() {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return // eslint-disable-next-line @typescript-eslint/no-unsafe-return
createHTML: (s) => s, createHTML: (s) => s,
}) as Policy; }) as Policy;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) { } catch (err) {
policy = null; policy = null;
} }

View File

@ -50,7 +50,6 @@ export function calculateSize(
let code = oldParts.shift() as string; let code = oldParts.shift() as string;
let isNumber = unitsTest.test(code); let isNumber = unitsTest.test(code);
// eslint-disable-next-line no-constant-condition
while (true) { while (true) {
if (isNumber) { if (isNumber) {
const num = parseFloat(code); const num = parseFloat(code);

File diff suppressed because it is too large Load Diff