fix prettier unparseable file issues

This commit is contained in:
maxichrome 2023-01-20 23:40:30 -08:00
parent 8477d5e73d
commit a0975ec8c0
6 changed files with 22 additions and 16 deletions

View file

@ -6,8 +6,5 @@ dist/
Pods/
# just in case it tries to parse for some reason
*.rs
# prettier sometimes can't parse these
*.d.ts
packages/interface/scripts/generateSvgImports.mjs
# we plainly don't need a lockfile to look nice
pnpm-lock.yaml

View file

@ -20,5 +20,7 @@ module.exports = {
'^\\.'
],
importOrderSortSpecifiers: true,
importOrderParserPlugins: ['importAssertions', 'typescript', 'jsx'],
pluginSearchDirs: ['.'],
plugins: ['@trivago/prettier-plugin-sort-imports']
};

View file

@ -29,17 +29,18 @@
}
},
"devDependencies": {
"@babel/plugin-syntax-import-assertions": "^7.20.0",
"@cspell/dict-rust": "^2.0.1",
"@cspell/dict-typescript": "^2.0.2",
"@evilmartians/lefthook": "^1.1.1",
"@trivago/prettier-plugin-sort-imports": "^3.3.0",
"@trivago/prettier-plugin-sort-imports": "^3.4.0",
"cspell": "^6.12.0",
"lint-staged": "^13.1.0",
"markdown-link-check": "^3.10.3",
"prettier": "^2.7.1",
"prettier": "^2.8.3",
"turbo": "^1.5.5",
"turbo-ignore": "^0.3.0",
"typescript": "^4.8.4"
"typescript": "^4.9.4"
},
"overrides": {
"vite-plugin-svgr": "https://github.com/spacedriveapp/vite-plugin-svgr#cb4195b69849429cdb18d1f12381676bf9196a84",

View file

@ -1,3 +1,4 @@
import { Alias } from "vite"
import type { Alias } from 'vite';
export const relativeAliasResolver: Alias
// should technically be const but Prettier somehow dislikes parsing this file that way
export let relativeAliasResolver: Alias;

View file

@ -2,7 +2,6 @@
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import { format as prettierFormat } from 'prettier';
import prettierConfig from '../../../.prettierrc.json' assert { type: 'json' };
/**
@ -20,7 +19,7 @@ function iconFriendlyName(iconName, delimeter = '-') {
}
function iconBaseName(filePath) {
return path.basename(filePath, path.extname(filePath))
return path.basename(filePath, path.extname(filePath));
}
async function exists(path) {
@ -40,7 +39,12 @@ async function exists(path) {
const generatedCode = `\
${icons
.map((path) => iconBaseName(path))
.map((baseName) => `import { ReactComponent as ${iconFriendlyName(baseName)} } from '@sd/assets/icons/${baseName}.svg';`)
.map(
(baseName) =>
`import { ReactComponent as ${iconFriendlyName(
baseName
)} } from '@sd/assets/icons/${baseName}.svg';`
)
.join('\n')}
export default {
@ -57,5 +61,5 @@ ${icons
await fs.rm(outPath);
}
await fs.writeFile(outPath, prettierFormat( generatedCode, prettierConfig));
await fs.writeFile(outPath, prettierFormat(generatedCode, prettierConfig));
})();

View file

@ -7,18 +7,20 @@ importers:
.:
specifiers:
'@babel/plugin-syntax-import-assertions': ^7.20.0
'@cspell/dict-rust': ^2.0.1
'@cspell/dict-typescript': ^2.0.2
'@evilmartians/lefthook': ^1.1.1
'@trivago/prettier-plugin-sort-imports': ^3.3.0
'@trivago/prettier-plugin-sort-imports': ^3.4.0
cspell: ^6.12.0
lint-staged: ^13.1.0
markdown-link-check: ^3.10.3
prettier: ^2.7.1
prettier: ^2.8.3
turbo: ^1.5.5
turbo-ignore: ^0.3.0
typescript: ^4.8.4
typescript: ^4.9.4
devDependencies:
'@babel/plugin-syntax-import-assertions': 7.20.0
'@cspell/dict-rust': 2.0.1
'@cspell/dict-typescript': 2.0.2
'@evilmartians/lefthook': 1.2.7
@ -1632,7 +1634,6 @@ packages:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/helper-plugin-utils': 7.20.2
dev: false
/@babel/plugin-syntax-import-assertions/7.20.0_@babel+core@7.20.12:
resolution: {integrity: sha512-IUh1vakzNoWalR8ch/areW7qFopR2AEw03JlG7BbrDqmQ4X3q9uuipQwSGrUn7oGiemKjtSLDhNtQHzMHr1JdQ==}