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"
},
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.13.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.8.6",
"@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
yarn.lock
tsconfig.tsbuildinfo
.eslintrc.cjs
eslint.config.*
tsconfig.json
tsconfig.common.json
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"
],
"dependencies": {
"@antfu/install-pkg": "^0.4.0",
"@antfu/install-pkg": "^0.4.1",
"@antfu/utils": "^0.7.10",
"@iconify/types": "workspace:^",
"debug": "^4.3.6",
"debug": "^4.3.7",
"globals": "^15.11.0",
"kolorist": "^1.8.0",
"local-pkg": "^0.5.0",
"mlly": "^1.7.1"
"mlly": "^1.7.2"
},
"devDependencies": {
"@iconify-json/fa6-regular": "^1.1.22",
"@iconify-json/flat-color-icons": "^1.1.11",
"@eslint/eslintrc": "^3.1.0",
"@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/jest": "^29.5.12",
"@types/node": "^18.19.45",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.10.0",
"@types/jest": "^29.5.14",
"@types/node": "^18.19.63",
"@typescript-eslint/eslint-plugin": "^8.12.2",
"eslint": "^9.13.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"rimraf": "^6.0.1",
"typescript": "^5.5.4",
"unbuild": "^1.2.1",
"vitest": "^0.34.6"
"typescript": "^5.6.3",
"unbuild": "^2.0.0",
"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 { defaultIconDimensions } from '../icon/defaults';

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff