Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna Vo committed Nov 3, 2023
1 parent 567bba9 commit 58d5c07
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .changeset/honest-lemons-glow.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
'eslint-plugin-widen': major
---

Updates all versions to latest with major version updates for @typescript-eslint and eslint-plugin-jest
Updates all versions to latest with major version updates for @typescript-eslint
and eslint-plugin-jest
2 changes: 1 addition & 1 deletion packages/eslint-plugin-widen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Add the following to your `.eslintrc` file.
✔: Enabled in the `recommended` configuration.\
🔧: Fixable with [`eslint --fix`](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems).

| | 🔧 | Rule | Description |
|| 🔧 | Rule | Description |
| :-: | :-: | -------------------------------------------- | ------------------------------------------------------------------------------------------- |
| | 🔧 | [widen/jsx-fragments](docs/jsx-fragments.md) | Enforce usage of JSX fragment longhand to allow for compatibility with Emotion. |
| | 🔧 | [widen/jsx-import](docs/jsx-import.md) | Enforces all files to use the `jsx` pragma from `@emotion/react` when using the `css` prop. |
8 changes: 4 additions & 4 deletions packages/eslint-plugin-widen/src/rules/jsx-fragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { JSXFragment } from 'estree-jsx'
import { docsURL } from '../utils'

const isImportDeclaration = (
node: ESTree.Node
node: ESTree.Node,
): node is ESTree.ImportDeclaration => node.type === 'ImportDeclaration'

export default {
Expand Down Expand Up @@ -46,11 +46,11 @@ export default {
return [
fixer.replaceText(
fragment.openingFragment as unknown as ESTree.Node,
`<${tag}>`
`<${tag}>`,
),
fixer.replaceText(
fragment.closingFragment as unknown as ESTree.Node,
`</${tag}>`
`</${tag}>`,
),
]
},
Expand All @@ -74,7 +74,7 @@ export default {
fix(fixer) {
return fixer.insertTextAfter(
node.specifiers[node.specifiers.length - 1],
', Fragment'
', Fragment',
)
},
messageId: 'missingImport',
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin-widen/src/rules/jsx-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ function addJsxImport(fixer: Rule.RuleFixer, node: ESTree.ImportDeclaration) {

return fixer.insertTextAfter(
specifier,
specifier.type === 'ImportSpecifier' ? ', jsx' : ', { jsx }'
specifier.type === 'ImportSpecifier' ? ', jsx' : ', { jsx }',
)
}

function removeReactImport(
source: SourceCode,
fixer: Rule.RuleFixer,
node: ESTree.ImportDeclaration
node: ESTree.ImportDeclaration,
) {
const specifier = node.specifiers.find((spec) => spec.local.name === 'React')
if (!specifier) return []
Expand All @@ -52,7 +52,7 @@ function applyRemainingFix(
source: SourceCode,
fixer: Rule.RuleFixer,
hasPragma: boolean,
emotionReactImport: ESTree.ImportDeclaration | null
emotionReactImport: ESTree.ImportDeclaration | null,
) {
const fix =
(hasPragma ? '' : '/** @jsx jsx */\n') +
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin-widen/src/rules/patterns-18.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const oldVariables = new Set([
function reportCssVariable(
context: Rule.RuleContext,
node: ESTree.Node,
value: string
value: string,
) {
const regex = /var\((--[a-z-]+)(,.*)?\)/g
const matches = value.matchAll(regex)
Expand Down Expand Up @@ -170,7 +170,7 @@ export default {
fix: (fixer) =>
fixer.replaceText(
attribute as unknown as ESTree.Node,
'status="' + statusMap[color] + '"'
'status="' + statusMap[color] + '"',
),
messageId: 'statusProp',
node,
Expand Down

0 comments on commit 58d5c07

Please sign in to comment.