-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prettier: split configs and use direct dependencies
- Loading branch information
Showing
14 changed files
with
144 additions
and
78 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Viam's Prettier Config for Svelte | ||
|
||
This module contains [Viam][]'s shared [Prettier][] configurations for Prettier v3 in [Svelte][] projects. | ||
|
||
[viam]: https://www.viam.com/ | ||
[prettier]: https://prettier.io/ | ||
[svelte]: https://svelte.dev/ | ||
|
||
## Usage | ||
|
||
Use the [Svelte config](./prettier-config-svelte.js) for Svelte projects. | ||
|
||
```shell | ||
pnpm add --save-dev prettier @viamrobotics/prettier-config-svelte | ||
``` | ||
|
||
```js | ||
// prettier.config.js | ||
export default '@viamrobotics/prettier-config-svelte'; | ||
``` | ||
|
||
You can also extend the configuration: | ||
|
||
```js | ||
// prettier.config.js | ||
import baseConfig from '@viamrobotics/prettier-config-svelte'; | ||
|
||
export default { | ||
...baseConfig, | ||
// other options here | ||
}; | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "@viamrobotics/prettier-config-svelte", | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
"version": "1.0.0", | ||
"description": "Viam's shared Prettier configuration for Svelte projects.", | ||
"type": "module", | ||
"files": [ | ||
"**/*", | ||
"!tsconfig.json" | ||
], | ||
"types": "./dist/prettier-config-svelte.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./dist/prettier-config-svelte.d.ts", | ||
"default": "./prettier-config-svelte.js" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/viamrobotics/js-config.git", | ||
"directory": "packages/prettier-config-svelte" | ||
}, | ||
"keywords": [ | ||
"prettier", | ||
"prettierconfig", | ||
"svelte" | ||
], | ||
"license": "Apache-2.0", | ||
"peerDependencies": { | ||
"prettier": ">=3 <4", | ||
"svelte": "*", | ||
"tailwindcss": "*" | ||
}, | ||
"dependencies": { | ||
"@viamrobotics/prettier-config": "workspace:*", | ||
"prettier-plugin-svelte": "^3.3.2", | ||
"prettier-plugin-tailwindcss": "^0.6.9" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import url from 'node:url'; | ||
|
||
import baseConfig from '@viamrobotics/prettier-config'; | ||
|
||
const sveltePlugin = url.fileURLToPath( | ||
import.meta.resolve('prettier-plugin-svelte') | ||
); | ||
const tailwindPlugin = url.fileURLToPath( | ||
import.meta.resolve('prettier-plugin-tailwindcss') | ||
); | ||
|
||
/** @satisfies {import('prettier').Config} */ | ||
const config = { | ||
...baseConfig, | ||
plugins: [sveltePlugin, tailwindPlugin], | ||
svelteIndentScriptAndStyle: false, | ||
tailwindAttributes: ['cx'], | ||
tailwindFunctions: ['classnames', 'cx'], | ||
}; | ||
|
||
export default config; |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "@viamrobotics/typescript-config/base.json", | ||
"compilerOptions": { | ||
"types": ["node"], | ||
"composite": true, | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"outDir": "dist" | ||
}, | ||
"references": [{ "path": "../prettier-config" }], | ||
"include": ["*.js"] | ||
} |
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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -7,5 +7,5 @@ | |
"emitDeclarationOnly": true, | ||
"outDir": "dist" | ||
}, | ||
"include": ["*.cjs"] | ||
"include": ["*.js"] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
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