-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(refactor): complete migrate to stylelint v16 (#263)
> [!NOTE] > > Поехало форматирование, т.к. в репе нет prettier конфига и всё форматировалось по настройкам моего IDE. > > В другом PR добавлю `.prettierrc`. В PR #238 не до конца мигрировал конфиги. Это выяснилось при попытке починить линты в VKCOM/VKUI#6606. Поэтому по рекомендациям https://stylelint.io/migration-guide/to-16 делаем следующие изменения: - добавляем в `package.json` поля `"type": "module"`, `"exports": "./index.js"` и `"module": "index.js"`; - в `typescript.config.js` задаём `module` и `moduleResolution" как `NodeNext`.⚠️ после этого в `*.ts` относительных импортах используем расширение `.js`; - заменяем `module.exports` на `exports default`; - `jest.config.js` тоже переписываем в ESM, а также задаём `moduleNameMapper`, чтобы резолвились относительные импорты с `.js`;
- Loading branch information
Showing
15 changed files
with
192 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
module.exports = { | ||
preset: "jest-preset-stylelint", | ||
import fs from 'node:fs'; | ||
import process from 'node:process'; | ||
|
||
export default { | ||
preset: 'jest-preset-stylelint', | ||
transform: { | ||
"^.+\\.(t|j)sx?$": "@swc/jest", | ||
'^.+\\.(t|j)sx?$': '@swc/jest', | ||
}, | ||
testEnvironment: "node", | ||
testEnvironment: 'node', | ||
// см. https://jestjs.io/ru/docs/ecmascript-modules | ||
extensionsToTreatAsEsm: [".ts"], | ||
extensionsToTreatAsEsm: ['.ts'], | ||
moduleNameMapper: { | ||
'^(\\.{1,2}/.*)\\.js$': '$1', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.