mirror of
https://github.com/robonen/tools.git
synced 2026-03-20 02:44:45 +00:00
feat(configs/oxlint): add linter
This commit is contained in:
@@ -1 +1,23 @@
|
||||
# @robonen/platform
|
||||
# @robonen/platform
|
||||
|
||||
Platform-dependent utilities for browser & multi-runtime environments.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
pnpm install @robonen/platform
|
||||
```
|
||||
|
||||
## Modules
|
||||
|
||||
| Entry | Utilities | Description |
|
||||
| ------------------ | ------------- | -------------------------------- |
|
||||
| `@robonen/platform/browsers` | `focusGuard` | Browser-specific helpers |
|
||||
| `@robonen/platform/multi` | `global` | Cross-runtime (Node/Bun/Deno) utilities |
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import { focusGuard } from '@robonen/platform/browsers';
|
||||
import { global } from '@robonen/platform/multi';
|
||||
```
|
||||
15
core/platform/oxlint.config.ts
Normal file
15
core/platform/oxlint.config.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { defineConfig } from 'oxlint';
|
||||
import { compose, base, typescript, imports } from '@robonen/oxlint';
|
||||
|
||||
export default defineConfig(
|
||||
compose(base, typescript, imports, {
|
||||
overrides: [
|
||||
{
|
||||
files: ['src/multi/global/index.ts'],
|
||||
rules: {
|
||||
'unicorn/prefer-global-this': 'off',
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
@@ -39,12 +39,15 @@
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "oxlint -c oxlint.config.ts",
|
||||
"test": "vitest run",
|
||||
"dev": "vitest dev",
|
||||
"build": "tsdown"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@robonen/oxlint": "workspace:*",
|
||||
"@robonen/tsconfig": "workspace:*",
|
||||
"oxlint": "catalog:",
|
||||
"tsdown": "catalog:"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* @since 0.0.3
|
||||
*/
|
||||
export function focusGuard(namespace: string = 'focus-guard') {
|
||||
export function focusGuard(namespace = 'focus-guard') {
|
||||
const guardAttr = `data-${namespace}`;
|
||||
|
||||
const createGuard = () => {
|
||||
@@ -39,7 +39,7 @@ export function focusGuard(namespace: string = 'focus-guard') {
|
||||
};
|
||||
}
|
||||
|
||||
export function createGuardAttrs(namespace: string) {
|
||||
export function createGuardAttrs(namespace = 'focus-guard') {
|
||||
const element = document.createElement('span');
|
||||
|
||||
element.setAttribute(namespace, '');
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// eslint-disable
|
||||
|
||||
export interface DebounceOptions {
|
||||
/**
|
||||
* Call the function on the leading edge of the timeout, instead of waiting for the trailing edge
|
||||
|
||||
Reference in New Issue
Block a user