-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* revert tsup build changes * add tsup config * rework build * make readable names for imports * fix `PluginDocs` type * add changeset * add eslint fix to rules generation
- Loading branch information
Showing
9 changed files
with
72 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'eslint-plugin-clsx': patch | ||
--- | ||
|
||
fix #16 critical build issue |
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,25 @@ | ||
/* eslint-disable @typescript-eslint/no-require-imports */ | ||
const fs = require('fs'); | ||
|
||
function camelize(s) { | ||
return s.replace(/-./g, (x) => x[1].toUpperCase()); | ||
} | ||
|
||
const ruleNames = fs | ||
.readdirSync(`${__dirname}/src/rules`) | ||
.filter( | ||
(fileName) => | ||
!fileName.includes('.test') && | ||
!fileName.includes('.generated') && | ||
fileName !== 'tests-setup.mjs' && | ||
fileName !== 'index.ts' | ||
) | ||
.map((fileName) => fileName.replace(/\.ts$/, '')); | ||
|
||
const imports = ruleNames.map((name) => `import ${camelize(name)} from './${name}';`).join('\n'); | ||
|
||
const pairs = ruleNames.map((name) => `"${name}": ${camelize(name)}`).join(',\n'); | ||
|
||
const content = `${imports}\nexport const allRules = {\n${pairs}\n};\n`; | ||
|
||
fs.writeFileSync(`${__dirname}/src/rules/allRules.generated.ts`, content); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 @@ | ||
export type PluginDocs = { recommended?: boolean }; |
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,5 +1,7 @@ | ||
import { ESLintUtils } from '@typescript-eslint/utils'; | ||
|
||
export const createRule = ESLintUtils.RuleCreator<{ recommended?: boolean }>( | ||
import type { PluginDocs } from './PluginDocs'; | ||
|
||
export const createRule = ESLintUtils.RuleCreator<PluginDocs>( | ||
(name) => `https://github.com/temoncher/eslint-plugin-clsx/blob/main/docs/rules/${name}.md` | ||
); |
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,19 @@ | ||
import forbidArrayExpressions from './forbid-array-expressions'; | ||
import forbidFalseInsideObjectExpressions from './forbid-false-inside-object-expressions'; | ||
import forbidTrueInsideObjectExpressions from './forbid-true-inside-object-expressions'; | ||
import noRedundantClsx from './no-redundant-clsx'; | ||
import noSpreading from './no-spreading'; | ||
import preferLogicalOverObjects from './prefer-logical-over-objects'; | ||
import preferMergedNeighboringElements from './prefer-merged-neighboring-elements'; | ||
import preferObjectsOverLogical from './prefer-objects-over-logical'; | ||
|
||
export const allRules = { | ||
'forbid-array-expressions': forbidArrayExpressions, | ||
'forbid-false-inside-object-expressions': forbidFalseInsideObjectExpressions, | ||
'forbid-true-inside-object-expressions': forbidTrueInsideObjectExpressions, | ||
'no-redundant-clsx': noRedundantClsx, | ||
'no-spreading': noSpreading, | ||
'prefer-logical-over-objects': preferLogicalOverObjects, | ||
'prefer-merged-neighboring-elements': preferMergedNeighboringElements, | ||
'prefer-objects-over-logical': preferObjectsOverLogical, | ||
}; |
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,9 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
export default defineConfig({ | ||
entry: ['src/index.ts'], | ||
splitting: false, | ||
sourcemap: false, | ||
clean: true, | ||
treeshake: true, | ||
}); |