Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit f8947f9

Browse files
authored
Add types for unicorn (#16)
1 parent 4c51931 commit f8947f9

File tree

132 files changed

+1282
-11
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1282
-11
lines changed

.eslintrc.cjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
const { defineConfig } = require('eslint-define-config');
33
const { readGitignoreFiles } = require('eslint-gitignore');
44

5-
/// <reference types="types/prettier" />
6-
/// <reference types="types/typescript-eslint" />
5+
/// <reference types="@eslint-types/prettier" />
6+
/// <reference types="@eslint-types/typescript-eslint" />
7+
/// <reference types="@eslint-types/unicorn" />
78

89
module.exports = defineConfig({
910
ignorePatterns: [

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"devDependencies": {
1818
"@eslint-types/prettier": "workspace:~",
1919
"@eslint-types/typescript-eslint": "workspace:~",
20+
"@eslint-types/unicorn": "workspace:~",
2021
"@types/eslint": "~8.44.6",
2122
"@types/json-schema": "~7.0.14",
2223
"@types/node": "~20.8.9",

pnpm-lock.yaml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/generate-plugin-dts.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,23 @@ for (const workspace of workspaces) {
4848
const pluginPackageJson: IPackageJson = await import(
4949
join(pluginDirectory, 'package.json')
5050
);
51-
const pluginEntry: string | undefined =
52-
pluginPackageJson.main ?? pluginPackageJson.exports?.['.']?.default;
53-
54-
if (!pluginEntry) {
55-
console.warn(`No entry found for ${pluginName}`);
56-
continue;
57-
}
51+
const pluginEntry: string =
52+
pluginPackageJson.main ??
53+
pluginPackageJson.exports?.['.']?.default ??
54+
'index.js';
5855

5956
const importedPluginModule:
6057
| (ESLint.Plugin & { __esModule: true })
61-
| { __esModule: undefined; default: ESLint.Plugin } = await import(
62-
join(pluginDirectory, pluginEntry)
58+
| { __esModule: undefined; default: ESLint.Plugin }
59+
| false = await import(join(pluginDirectory, pluginEntry)).catch(
60+
() => false,
6361
);
6462

63+
if (!importedPluginModule) {
64+
console.warn(`No entry found for ${pluginName}`);
65+
continue;
66+
}
67+
6568
const pluginModule = importedPluginModule.__esModule
6669
? importedPluginModule
6770
: importedPluginModule.default;

types/unicorn/index.d.ts

Lines changed: 896 additions & 0 deletions
Large diffs are not rendered by default.

types/unicorn/package.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "@eslint-types/unicorn",
3+
"version": "48.0.1",
4+
"description": "TypeScript definitions for eslint-define-config",
5+
"homepage": "https://github.com/eslint-types/define-config-plugin-types/tree/main/types/unicorn",
6+
"license": "MIT",
7+
"contributors": [
8+
{
9+
"name": "Christopher Quadflieg",
10+
"url": "https://github.com/Shinigami92",
11+
"githubUsername": "Shinigami92"
12+
}
13+
],
14+
"main": "",
15+
"types": "index.d.ts",
16+
"repository": {
17+
"type": "git",
18+
"url": "https://github.com/eslint-types/define-config-plugin-types.git",
19+
"directory": "types/unicorn"
20+
},
21+
"scripts": {},
22+
"dependencies": {},
23+
"devDependencies": {
24+
"eslint-plugin-unicorn": "48.0.1"
25+
},
26+
"exports": {
27+
".": {
28+
"types": "./index.d.ts"
29+
},
30+
"./package.json": "./package.json"
31+
}
32+
}

types/unicorn/rules/better-regex.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface Schema0 {
2+
sortCharacterClasses?: boolean;
3+
}
4+
5+
export type BetterRegexRuleOptions = [Schema0?];
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface Schema0 {
2+
name?: string;
3+
ignore?: unknown[];
4+
}
5+
6+
export type CatchErrorNameRuleOptions = [Schema0?];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type ConsistentDestructuringRuleOptions = [];
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface Schema0 {
2+
checkArrowFunctions?: boolean;
3+
}
4+
5+
export type ConsistentFunctionScopingRuleOptions = [Schema0?];

0 commit comments

Comments
 (0)