Skip to content

Commit fa7e102

Browse files
committed
feat: upgrade dependencies
1 parent 9bda3b0 commit fa7e102

25 files changed

+3329
-2252
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// @ts-check
2+
import globals from "globals";
3+
import eslint from "@eslint/js";
4+
import tseslint from "typescript-eslint";
5+
import prettierLintRecommended from "eslint-plugin-prettier/recommended";
6+
import jest from "eslint-plugin-jest";
7+
8+
/**
9+
* @typedef {import('@typescript-eslint/utils').TSESLint.FlatConfig.Config["rules"]} ESLintRules
10+
* @typedef {import('@typescript-eslint/utils').TSESLint.FlatConfig.Config["languageOptions"]} LanguageOptions
11+
*/
12+
13+
/** @type {ESLintRules} */
14+
const BASE_RULES = {
15+
"@typescript-eslint/camelcase": 0,
16+
"@typescript-eslint/explicit-function-return-type": 0,
17+
"@typescript-eslint/explicit-module-boundary-types": 0,
18+
"@typescript-eslint/no-explicit-any": 0,
19+
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
20+
"@typescript-eslint/no-var-requires": 0,
21+
"@typescript-eslint/ban-ts-comment": 1,
22+
"prettier/prettier": "error",
23+
"no-console": "error",
24+
};
25+
26+
/** @type {LanguageOptions} */
27+
const BASE_LANGUAGE_OPTIONS = {
28+
ecmaVersion: 2022,
29+
sourceType: "module",
30+
globals: {
31+
...globals.browser,
32+
...globals.node,
33+
},
34+
};
35+
36+
export default tseslint.config(
37+
eslint.configs.recommended,
38+
prettierLintRecommended,
39+
...tseslint.configs.recommended,
40+
{
41+
files: ["src/**/*.ts"],
42+
ignores: ["out/", "src/test/", "src/scripts/"],
43+
languageOptions: {
44+
...BASE_LANGUAGE_OPTIONS,
45+
},
46+
rules: BASE_RULES,
47+
},
48+
{
49+
files: ["src/test/**/*.ts"],
50+
ignores: ["out/", "src/scripts/"],
51+
...jest.configs["flat/recommended"],
52+
languageOptions: {
53+
...BASE_LANGUAGE_OPTIONS,
54+
},
55+
rules: {
56+
...jest.configs["flat/recommended"].rules,
57+
...BASE_RULES,
58+
},
59+
}
60+
);

examples/basics/local.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ body {
1515
width: var(--container-size);
1616
padding: var(--container-padding);
1717
background-color: var(--test-custom-selector);
18-
color: --gray
18+
color: var(--gray-1);
1919
}

examples/js-parser/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { css } from "@linaria/core";
22

33
const rootClass = css`
4-
color: var(--brand);
4+
color: var(--color-green);
55
background-color: var(--color-blue);
66
77
.head {

examples/js-parser/src/global/Layout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import { styled } from "@linaria/react";
32

43
export default styled.div`
@@ -8,7 +7,7 @@ export default styled.div`
87
--h3: 24px;
98
109
--color-red: red;
11-
--color-green: green;
10+
--color-green: lab(50.22% -49 38.39);
1211
--color-blue: blue;
1312
}
1413
`;

package.json

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -414,56 +414,58 @@
414414
"prebuild": "rimraf out",
415415
"build": "cross-env NODE_ENV=production rollup -c --environment INCLUDE_DEPS,BUILD,NODE_ENV:production",
416416
"watch": "rollup -c -m -w",
417-
"lint": "eslint src --ext ts",
418-
"lint:fix": "eslint src --ext ts --fix",
417+
"lint": "eslint src",
418+
"lint:fix": "eslint src --fix",
419419
"test": "concurrently \"tsc --project ./tsconfig.json --noEmit\" \"jest\"",
420420
"jest": "jest"
421421
},
422422
"devDependencies": {
423-
"@babel/core": "^7.17.8",
424-
"@babel/preset-env": "^7.16.11",
425-
"@babel/preset-typescript": "^7.16.7",
426-
"@rollup/plugin-commonjs": "^18.1.0",
427-
"@rollup/plugin-json": "^4.1.0",
428-
"@rollup/plugin-node-resolve": "^11.2.1",
429-
"@rollup/plugin-replace": "^4.0.0",
423+
"@babel/core": "^7.25.2",
424+
"@babel/preset-env": "^7.25.4",
425+
"@babel/preset-typescript": "^7.24.7",
426+
"@eslint/js": "^9.11.1",
427+
"@rollup/plugin-commonjs": "^28.0.0",
428+
"@rollup/plugin-json": "^6.1.0",
429+
"@rollup/plugin-node-resolve": "^15.3.0",
430+
"@rollup/plugin-replace": "^6.0.1",
430431
"@tokencss/postcss": "^0.0.5",
431-
"@types/css": "^0.0.31",
432-
"@types/glob": "^7.2.0",
433-
"@types/jest": "^29.1.2",
434-
"@types/lodash": "^4.14.180",
435-
"@types/node": "^18.11.0",
436-
"@types/postcss-less": "^4.0.2",
437-
"@types/postcss-safe-parser": "^5.0.1",
438-
"@types/vscode": "1.53.0",
439-
"@typescript-eslint/eslint-plugin": "^5.40.0",
440-
"@typescript-eslint/parser": "^5.40.0",
441-
"babel-jest": "^29.2.0",
442-
"concurrently": "^7.3.0",
432+
"@types/css": "^0.0.37",
433+
"@types/eslint__js": "^8.42.3",
434+
"@types/glob": "^8.1.0",
435+
"@types/jest": "^29.5.13",
436+
"@types/lodash": "^4.17.9",
437+
"@types/node": "^18.19.50",
438+
"@types/postcss-less": "^4.0.6",
439+
"@types/postcss-safe-parser": "^5.0.4",
440+
"@types/vscode": "1.93.0",
441+
"babel-jest": "^29.7.0",
442+
"concurrently": "^9.0.1",
443443
"cross-env": "^7.0.3",
444-
"dayjs": "^1.11.5",
445-
"dotenv": "^16.0.2",
446-
"esbuild": "^0.14.49",
447-
"eslint": "^8.25.0",
448-
"eslint-config-prettier": "^8.5.0",
449-
"eslint-plugin-jest": "^27.1.2",
450-
"eslint-plugin-prettier": "^3.4.1",
451-
"husky": "^5.2.0",
452-
"jest": "^29.2.0",
453-
"lint-staged": "^10.5.4",
444+
"dayjs": "^1.11.13",
445+
"dotenv": "^16.4.5",
446+
"esbuild": "^0.24.0",
447+
"eslint": "^9.11.1",
448+
"eslint-config-prettier": "^9.1.0",
449+
"eslint-plugin-jest": "^28.8.3",
450+
"eslint-plugin-prettier": "^5.2.1",
451+
"globals": "^15.9.0",
452+
"husky": "^9.1.6",
453+
"jest": "^29.7.0",
454+
"lint-staged": "^15.2.10",
454455
"lodash": "^4.17.21",
455-
"prettier": "^2.6.1",
456-
"rimraf": "^3.0.2",
457-
"rollup": "^2.70.1",
458-
"rollup-plugin-esbuild": "^4.9.1",
459-
"typescript": "^4.8.4",
460-
"yargs": "^17.5.1"
456+
"prettier": "^3.3.3",
457+
"rimraf": "^6.0.1",
458+
"rollup": "^4.22.4",
459+
"rollup-plugin-esbuild": "^6.1.1",
460+
"typescript": "5.5.2",
461+
"typescript-eslint": "^8.7.0",
462+
"yargs": "^17.7.2"
461463
},
462464
"dependencies": {
463465
"culori": "^2.0.3",
464-
"fast-glob": "^3.2.12",
465-
"follow-redirects": "^1.15.2",
466-
"postcss": "^8.4.12",
466+
"fast-glob": "^3.3.2",
467+
"follow-redirects": "^1.15.9",
468+
"postcss": "^8.4.47",
467469
"postcss-less": "^6.0.0"
468470
},
469471
"lint-staged": {

rollup.config.js renamed to rollup.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import commonjs from "@rollup/plugin-commonjs";
33
import replace from "@rollup/plugin-replace";
44
import json from "@rollup/plugin-json";
55
import esbuild from "rollup-plugin-esbuild";
6-
import pkg from "./package.json";
7-
import tsConfig from "./tsconfig.json";
6+
import pkg from "./package.json" with { type: "json" };
7+
import tsConfig from "./tsconfig.json" with { type: "json" };
88

99
const isProd = process.env.NODE_ENV === "production";
1010

src/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ export const CSS_IDS = [
1818
"astro",
1919
] as const;
2020
export const SUPPORTED_LANGUAGE_IDS = [...CSS_IDS, ...JS_IDS] as const;
21-
export type SupportedLanguageIds = typeof SUPPORTED_LANGUAGE_IDS[number];
21+
export type SupportedLanguageIds = (typeof SUPPORTED_LANGUAGE_IDS)[number];
2222
export type ExtendedLanguageIds = "stylus" | "sugarss" | "handlebars";
2323
export type CssExtensions = Exclude<
24-
typeof CSS_IDS[number],
24+
(typeof CSS_IDS)[number],
2525
"vue" | "svelte" | "astro"
2626
>;
2727

src/parser.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ const cssParseAsync = async (
8585

8686
if (syntaxModuleName) {
8787
try {
88-
options.syntax = require(require.resolve(syntaxModuleName, {
89-
paths: rootPathsOrUndefined,
90-
}));
88+
// eslint-disable-next-line @typescript-eslint/no-require-imports
89+
options.syntax = require(
90+
require.resolve(syntaxModuleName, {
91+
paths: rootPathsOrUndefined,
92+
})
93+
);
9194
} catch (e: any) {
9295
window.showErrorMessage(
9396
`Cannot resolve postcss syntax module ${syntaxModuleName}. Please add postcss@8 as project's dependency.`
@@ -412,19 +415,22 @@ const parseFilesForSingleFolder = async function (
412415
try {
413416
const [vars, cssVarsMap] = await populateValue(cssVars);
414417
CACHE.cssVarCount[rootPath] = vars.length;
415-
CACHE.cssVarDefinitionsMap[rootPath] = vars.reduce((defs, cssVar) => {
416-
if (!cssVar.location) {
417-
return defs;
418-
}
418+
CACHE.cssVarDefinitionsMap[rootPath] = vars.reduce(
419+
(defs, cssVar) => {
420+
if (!cssVar.location) {
421+
return defs;
422+
}
419423

420-
const key = cssVar.property;
421-
if (key in defs) {
422-
defs[key].push(cssVar.location);
423-
} else {
424-
defs[key] = [cssVar.location];
425-
}
426-
return defs;
427-
}, {} as CacheType["cssVarDefinitionsMap"][string]);
424+
const key = cssVar.property;
425+
if (key in defs) {
426+
defs[key].push(cssVar.location);
427+
} else {
428+
defs[key] = [cssVar.location];
429+
}
430+
return defs;
431+
},
432+
{} as CacheType["cssVarDefinitionsMap"][string]
433+
);
428434
CACHE.cssVarsMap[rootPath] = cssVarsMap;
429435
} catch (e) {
430436
window.showErrorMessage(`Populating Variable Values: ${e}`);

0 commit comments

Comments
 (0)