Skip to content

Commit

Permalink
fix: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed May 8, 2024
1 parent 746f683 commit 02d9740
Show file tree
Hide file tree
Showing 4 changed files with 324 additions and 0 deletions.
185 changes: 185 additions & 0 deletions packages/iso-config/biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
"vcs": {
"clientKind": "git",
"enabled": true,
"useIgnoreFile": true
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto"
},
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"noBannedTypes": "error",
"noExtraBooleanCast": "error",
"noForEach": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noStaticOnlyClass": "error",
"noUselessCatch": "error",
"noUselessConstructor": "error",
"noUselessLoneBlockStatements": "error",
"noUselessRename": "error",
"noUselessSwitchCase": "error",
"noUselessTernary": "error",
"noUselessThisAlias": "error",
"noUselessTypeConstraint": "error",
"noVoid": "error",
"noWith": "error",
"useFlatMap": "error",
"useLiteralKeys": "error",
"useOptionalChain": "error",
"useRegexLiterals": "error",
"useSimpleNumberKeys": "off"
},
"correctness": {
"noConstAssign": "error",
"noConstantCondition": "error",
"noEmptyCharacterClassInRegex": "error",
"noEmptyPattern": "error",
"noGlobalObjectCalls": "error",
"noInvalidConstructorSuper": "error",
"noInvalidUseBeforeDeclaration": "error",
"noNewSymbol": "error",
"noPrecisionLoss": "error",
"noSelfAssign": "error",
"noSwitchDeclarations": "error",
"noUndeclaredVariables": "off",
"noUnreachable": "error",
"noUnreachableSuper": "error",
"noUnsafeFinally": "error",
"noUnusedVariables": "error",
"useIsNan": "error",
"useYield": "error"
},
"security": { "noGlobalEval": "error" },
"style": {
"noParameterAssign": "off",
"noCommaOperator": "error",
"noNamespace": "error",
"noNegationElse": "off",
"noNonNullAssertion": "error",
"noRestrictedGlobals": {
"level": "error",
"options": { "deniedGlobals": ["global", "self"] }
},
"noVar": "warn",
// "useBlockStatements": "error",
"useConsistentArrayType": {
"level": "error",
"options": { "syntax": "shorthand" }
},
"useConst": "error",
"useExportType": "error",
"useFilenamingConvention": {
"level": "error",
"options": { "requireAscii": true, "filenameCases": ["kebab-case"] }
},
"useForOf": "off",
"useImportType": "error",
// "useNamingConvention": {
// "level": "error",
// "options": { "strictCase": false, "enumMemberCase": "CONSTANT_CASE" }
// },
"useNodejsImportProtocol": "off",
"useNumberNamespace": "error",
"useShorthandFunctionType": "error",
"useSingleVarDeclarator": "error",
"useDefaultParameterLast": "warn"
},
"suspicious": {
"noAssignInExpressions": "warn",
"noAsyncPromiseExecutor": "error",
"noCatchAssign": "error",
"noClassAssign": "error",
"noCompareNegZero": "error",
"noConfusingLabels": "error",
"noConfusingVoidType": "error",
"noConsoleLog": "error",
"noControlCharactersInRegex": "error",
"noDebugger": "error",
"noDoubleEquals": "error",
"noDuplicateCase": "error",
"noDuplicateClassMembers": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noEmptyBlockStatements": "error",
"noEmptyInterface": "error",
"noExtraNonNullAssertion": "error",
"noFallthroughSwitchClause": "error",
"noFunctionAssign": "error",
"noGlobalAssign": "error",
"noImportAssign": "error",
"noMisleadingCharacterClass": "error",
"noMisleadingInstantiator": "error",
"noPrototypeBuiltins": "error",
"noRedeclare": "error",
"noSelfCompare": "error",
"noShadowRestrictedNames": "error",
"noThenProperty": "error",
"noUnsafeNegation": "error",
"useDefaultSwitchClauseLast": "error",
"useIsArray": "error",
"useValidTypeof": "error",
"noExportsInTest": "off"
}
},
"ignore": [
"**/node_modules",
"**/dist",
"**/package-lock.json",
"**/yarn.lock",
"**/pnpm-lock.yaml",
"**/bun.lockb",

"**/output",
"**/coverage",
"**/temp",
"**/.temp",
"**/tmp",
"**/.tmp",
"**/.history",
"**/.vitepress/cache",
"**/.nuxt",
"**/.next",
"**/.vercel",
"**/.changeset",
"**/.idea",
"**/.cache",
"**/.output",
"**/.vite-inspect",
"**/.yarn",

"**/CHANGELOG*.md",
"**/*.min.*",
"**/LICENSE*",
"**/__snapshots__",
"**/auto-import?(s).d.ts",
"**/components.d.ts",
"**/mockServiceWorker.js"
]
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingComma": "es5",
"semicolons": "asNeeded",
"arrowParentheses": "always",
"bracketSpacing": true,
"bracketSameLine": false,
"quoteStyle": "single",
"attributePosition": "auto"
},
"globals": ["document", "navigator", "window"]
}
}
34 changes: 34 additions & 0 deletions packages/iso-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "iso-config",
"type": "module",
"version": "0.0.1",
"description": "JS tooling configs",
"author": "Hugo Dias <hugomrdias@gmail.com> (hugodias.me)",
"license": "MIT",
"repository": {
"url": "hugomrdias/iso-repo",
"directory": "packages/iso-config"
},
"keywords": ["biome", "typescript", "config", "tooling"],
"exports": {
"./biome": "./biome.jsonc",
"./tsconfig": "./tsconfig.json"
},
"scripts": {
"lint": "biome check --no-errors-on-unmatched --files-ignore-unknown=true ."
},
"devDependencies": {
"@types/node": "^20.11.30",
"typescript": "5.4.5"
},
"publishConfig": {
"provenance": true
},
"depcheck": {
"specials": ["bin"],
"ignores": ["@types/*"]
},
"peerDependencies": {
"@biomejs/biome": "^1.7.3"
}
}
63 changes: 63 additions & 0 deletions packages/iso-config/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# iso-config [![NPM Version](https://img.shields.io/npm/v/iso-config.svg)](https://www.npmjs.com/package/iso-config) [![License](https://img.shields.io/npm/l/iso-config.svg)](https://github.com/hugomrdias/iso-repo/blob/main/license) [![iso-config](https://github.com/hugomrdias/iso-repo/actions/workflows/iso-config.yml/badge.svg)](https://github.com/hugomrdias/iso-repo/actions/workflows/iso-config.yml)

> JS tooling config
## Install

```bash
pnpm install iso-config
```

## Usage

`package.json`

```json
{
"main": "src/index.js",
"types": "dist/src/index.d.ts",
"files": ["dist/src", "src", "index.js", "cli.js"],
"scripts": {
"lint": "biome check --no-errors-on-unmatched --files-ignore-unknown=true ."
},
"simple-git-hooks": {
"pre-commit": "npx lint-staged"
},
"lint-staged": {
"*": "biome check --no-errors-on-unmatched --files-ignore-unknown=true"
}
}
```

`tsconfig.json`

```json
{
"extends": "iso-config/tsconfig",
"compilerOptions": {
"outDir": "dist",
"emitDeclarationOnly": true
},
"include": ["src", "test.js", "cli.js", "package.json"]
}
```

For typescript code bases:

```json
{
"extends": "iso-config/tsconfig",
"compilerOptions": {
"outDir": "dist",
"module": "NodeNext",
"moduleResolution": "NodeNext"
},
"include": ["src", "test.js", "cli.js", "package.json"]
}
```

In monorepos you can install `iso-config` only in the root and extend the root `tsconfig.json` in the packages.

## License

MIT © [Hugo Dias](http://hugodias.me)
42 changes: 42 additions & 0 deletions packages/iso-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"compilerOptions": {
/* Projects */
"incremental": true,
"composite": true,
/* Language and Environment */
"target": "ES2022",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"moduleDetection": "force",
/* Modules */
"module": "ESNext", // "NodeNext"
"moduleResolution": "Bundler", // "NodeNext"
"resolveJsonModule": true,
/* JavaScript Support */
"allowJs": true,
"checkJs": true,
/* Emit */
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": false,
"sourceMap": true,
"outDir": "dist",
"removeComments": false,
"noEmit": false,
"importsNotUsedAsValues": "remove",
"stripInternal": true,
"noEmitOnError": true,
/* Interop Constraints */
"isolatedModules": true,
"verbatimModuleSyntax": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
/* Type Checking */
"strict": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": false,
"noUnusedLocals": true,
"noUnusedParameters": false,
"skipLibCheck": true
},
"include": ["src", "mocks", "eslint"]
}

0 comments on commit 02d9740

Please sign in to comment.