Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
636 additions
and
162 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
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,29 @@ | ||
# @unocss/eslint-config | ||
|
||
ESLint config for UnoCSS. | ||
|
||
**Currently working in progress, breaking changes may NOT follow semver.** | ||
|
||
## Installation | ||
|
||
```bash | ||
npm i -D @unocss/eslint-config | ||
``` | ||
|
||
In `.eslintrc`: | ||
|
||
```json | ||
{ | ||
"extends": [ | ||
"@unocss" | ||
] | ||
} | ||
``` | ||
|
||
## Rules | ||
|
||
- `@unocss/order` - Enforce a specific order for class and attribute selectors. | ||
|
||
## Prior Arts | ||
|
||
Thanks to [eslint-plugin-unocss](https://github.com/devunt/eslint-plugin-unocss) by [@devunt](https://github.com/devunt). |
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 @@ | ||
import { defineBuildConfig } from 'unbuild' | ||
|
||
export default defineBuildConfig({ | ||
entries: [ | ||
'src/index', | ||
], | ||
clean: true, | ||
declaration: true, | ||
rollup: { | ||
emitCJS: true, | ||
}, | ||
}) |
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": "@unocss/eslint-config", | ||
"version": "0.0.0", | ||
"description": "ESLint config for UnoCSS", | ||
"author": "Anthony Fu <anthonyfu117@hotmail.com>", | ||
"license": "MIT", | ||
"funding": "https://github.com/sponsors/antfu", | ||
"homepage": "https://github.com/unocss/unocss/tree/main/packages/eslint-config#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/unocss/unocss.git", | ||
"directory": "packages/eslint-config" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/unocss/unocss/issues" | ||
}, | ||
"keywords": ["eslint-config", "eslint"], | ||
"sideEffects": false, | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"require": "./dist/index.cjs", | ||
"import": "./dist/index.mjs" | ||
} | ||
}, | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"scripts": { | ||
"build": "unbuild", | ||
"stub": "unbuild --stub" | ||
}, | ||
"dependencies": { | ||
"@unocss/eslint-plugin": "workspace:*" | ||
} | ||
} |
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 @@ | ||
export default { | ||
extends: [ | ||
'plugin:@unocss/recommended', | ||
], | ||
} |
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 @@ | ||
# @unocss/eslint-plugin | ||
|
||
ESLint plugin for UnoCSS. | ||
|
||
**Currently working in progress, breaking changes may NOT follow semver.** | ||
|
||
## Installation | ||
|
||
Please refer to [@unocss/eslint-config](../eslint-config/) for installation. |
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,14 @@ | ||
import { defineBuildConfig } from 'unbuild' | ||
|
||
export default defineBuildConfig({ | ||
entries: [ | ||
'src/dirs', | ||
'src/index', | ||
'src/worker-sort', | ||
], | ||
clean: true, | ||
declaration: true, | ||
rollup: { | ||
emitCJS: true, | ||
}, | ||
}) |
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 @@ | ||
.eslintrc.json |
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,6 @@ | ||
{ | ||
"extends": [ | ||
"@antfu", | ||
"plugin:@unocss/recommended" | ||
] | ||
} |
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,23 @@ | ||
<template> | ||
<div flex="~ gap-1 cols"> | ||
<div class="hover:text-red text-4xl mx1 m2"> | ||
<div i-carbon-campsite inline-block /> | ||
</div> | ||
<p> | ||
<a rel="noreferrer" href="https://github.com/antfu/vitesse" target="_blank"> | ||
Vitesse | ||
</a> | ||
</p> | ||
<p> | ||
<em text-sm opacity-75 class="foo" hover:text-red text-4xl mx1 m2>{{ t('intro.desc') }}</em> | ||
</p> | ||
|
||
<div class="hover:(text-red text-4xl) hover:mx1 mx1 m2">Variant group</div> | ||
|
||
<div class=" | ||
foo bar | ||
hover:(text-red text-4xl) | ||
hover:mx1 mx1 m2 | ||
"></div> | ||
</div> | ||
</template> |
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,7 @@ | ||
export default function App() { | ||
return ( | ||
<h1 className="text-3xl hover:text-red m1 font-bold underline"> | ||
Hello world! | ||
</h1> | ||
) | ||
} |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": [ | ||
"dom", | ||
"dom.iterable", | ||
"esnext" | ||
], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"esModuleInterop": true, | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
"jsx": "react" | ||
}, | ||
"include": [ | ||
"src" | ||
] | ||
} |
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,11 @@ | ||
// eslint-disable-next-line no-restricted-imports | ||
import { defineConfig, presetUno, transformerVariantGroup } from 'unocss' | ||
|
||
export default defineConfig({ | ||
presets: [ | ||
presetUno(), | ||
], | ||
transformers: [ | ||
transformerVariantGroup(), | ||
], | ||
}) |
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,52 @@ | ||
{ | ||
"name": "@unocss/eslint-plugin", | ||
"version": "0.0.0", | ||
"description": "ESLint plugin for UnoCSS", | ||
"author": "Anthony Fu <anthonyfu117@hotmail.com>", | ||
"license": "MIT", | ||
"funding": "https://github.com/sponsors/antfu", | ||
"homepage": "https://github.com/unocss/unocss/tree/main/packages/esling-plugin#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/unocss/unocss.git", | ||
"directory": "packages/esling-plugin" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/unocss/unocss/issues" | ||
}, | ||
"keywords": [ | ||
"eslint-plugin", | ||
"eslint" | ||
], | ||
"sideEffects": false, | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"require": "./dist/index.cjs", | ||
"import": "./dist/index.mjs" | ||
} | ||
}, | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"scripts": { | ||
"build": "unbuild", | ||
"lint": "nr build && cd ./fixtures && eslint ./src" | ||
}, | ||
"dependencies": { | ||
"@typescript-eslint/utils": "^5.50.0", | ||
"@unocss/config": "workspace:^0.49.2", | ||
"@unocss/core": "workspace:*", | ||
"magic-string": "^0.27.0", | ||
"synckit": "^0.8.5" | ||
}, | ||
"devDependencies": { | ||
"@unocss/eslint-plugin": "workspace:*" | ||
} | ||
} |
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,7 @@ | ||
export default { | ||
plugins: ['@unocss'], | ||
rules: { | ||
'@unocss/order': 'warn', | ||
'@unocss/order-attributify': 'warn', | ||
}, | ||
} |
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 const CLASS_FIELDS = ['class', 'classname'] |
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,3 @@ | ||
import { fileURLToPath } from 'url' | ||
|
||
export const distDir = fileURLToPath(new URL('../dist', import.meta.url)) |
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,13 @@ | ||
import order from './rules/order' | ||
import orderAttributify from './rules/order-attributify' | ||
import configsRecommended from './configs/recommended' | ||
|
||
export default { | ||
rules: { | ||
order, | ||
'order-attributify': orderAttributify, | ||
}, | ||
configs: { | ||
recommended: configsRecommended, | ||
}, | ||
} |
Oops, something went wrong.