Skip to content

Commit

Permalink
refactor: drop import assertions and inline prettierrcs
Browse files Browse the repository at this point in the history
The Import Assertions proposal is superceded by the Import Attributes
proposal. <https://github.com/tc39/proposal-import-attributes>

So Node.js support for this syntax might be deprecated or even dropped
in the future.
Inlining these JSON objects is safer, though a bit less maintainable.
But I think it's acceptable for those rarely touched configs.
  • Loading branch information
haoqunjiang committed Jul 23, 2023
1 parent b68a1c1 commit 78bc3d6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 42 deletions.
16 changes: 0 additions & 16 deletions templates/prettierrc-airbnb.json

This file was deleted.

8 changes: 0 additions & 8 deletions templates/prettierrc-default.json

This file was deleted.

14 changes: 0 additions & 14 deletions templates/prettierrc-standard.json

This file was deleted.

44 changes: 40 additions & 4 deletions templates/prettierrcs.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,47 @@
import defaultConfig from './prettierrc-default.json' assert { type: 'json' }
const defaultConfig = {
$schema: 'https://json.schemastore.org/prettierrc',
semi: false,
tabWidth: 2,
singleQuote: true,
printWidth: 100,
trailingComma: 'none'
}

const airbnb = {
$schema: 'https://json.schemastore.org/prettierrc',
arrowParens: 'always',
bracketSameLine: false,
bracketSpacing: true,
endOfLine: 'lf',
jsxSingleQuote: false,
printWidth: 100,
proseWrap: 'preserve',
quoteProps: 'as-needed',
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
useTabs: false
}

import airbnb from './prettierrc-airbnb.json' assert { type: 'json' }
import standard from './prettierrc-standard.json' assert { type: 'json' }
const standard = {
$schema: 'https://json.schemastore.org/prettierrc',
arrowParens: 'always',
bracketSameLine: false,
bracketSpacing: true,
jsxSingleQuote: true,
proseWrap: 'preserve',
quoteProps: 'as-needed',
semi: false,
singleQuote: true,
tabWidth: 2,
trailingComma: 'none',
useTabs: false
}

export {
defaultConfig as default,

airbnb,
standard,
standard
}

0 comments on commit 78bc3d6

Please sign in to comment.