feat: add lint and format scripts

This commit is contained in:
Valerio Ageno
2024-04-27 10:40:14 +02:00
parent 5d28ffcf33
commit df8d1659c7
11 changed files with 200 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
node_modules/
dist/
.turbo/
pnpm-lock.yaml
+2
View File
@@ -0,0 +1,2 @@
dist/
pnpm-lock.yaml
+5
View File
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "all"
}
+107
View File
@@ -0,0 +1,107 @@
// @ts-check
/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
reportUnusedDisableDirectives: true,
ignorePatterns: ["**/build", "**/dist"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "import"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/stylistic",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier",
],
env: {
browser: true,
es2020: true,
},
parserOptions: {
tsconfigRootDir: __dirname,
project: true,
sourceType: "module",
ecmaVersion: 2020,
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: true,
},
react: {
version: "detect",
},
},
rules: {
"@typescript-eslint/array-type": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{ prefer: "type-imports" },
],
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/method-signature-style": ["error", "property"],
"@typescript-eslint/naming-convention": [
"error",
{
selector: "typeParameter",
format: ["PascalCase"],
leadingUnderscore: "forbid",
trailingUnderscore: "forbid",
custom: {
regex: "^(T|T[A-Z][A-Za-z]+)$",
match: true,
},
},
],
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-inferrable-types": [
"error",
{ ignoreParameters: true },
],
"import/default": "error",
"import/export": "error",
"import/namespace": "error",
"import/newline-after-import": "error",
"import/no-cycle": "error",
"import/no-duplicates": "off",
"import/no-named-as-default-member": "error",
"import/no-unused-modules": "error",
"import/order": [
"error",
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type",
],
},
],
"no-case-declarations": "error",
"no-empty": "error",
"no-prototype-builtins": "error",
"no-redeclare": "error",
"no-shadow": "error",
"no-undef": "error",
"sort-imports": "error",
},
};
module.exports = config;
+25
View File
@@ -0,0 +1,25 @@
{
"name": "tuono",
"version": "0.1.0",
"description": "",
"main": "index.js",
"packageManager": "pnpm@8.12.1",
"scripts": {
"lint": "turbo lint",
"format": "turbo format"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^3.2.4"
}
}
+2
View File
@@ -1,5 +1,7 @@
# [Tuono] Vite FS Router
> Strongly inspired by [@tanstack/router/router-vite-plugin](https://github.com/TanStack/router/tree/main/packages/router-vite-plugin)
This is the [vite](https://vitejs.dev/) plugin that automatically handles the file system routing.
+13
View File
@@ -0,0 +1,13 @@
{
"name": "vite-fs-router",
"version": "0.1.0",
"description": "",
"main": "src/index.js",
"scripts": {
"lint": "eslint --ext .ts,.tsx ./src -c ../../eslintrc.cjs",
"format": "prettier --ignore-unknown '**/*'"
},
"keywords": [],
"author": "Valerio Ageno",
"license": "MIT"
}
+9
View File
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"include": ["src", "vite.config.ts", "tests"],
"exclude": ["tests/test-files/**", "tests/snapshots/**"],
"compilerOptions": {
"jsx": "react",
},
}
+27
View File
@@ -0,0 +1,27 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"checkJs": true,
"declaration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"module": "ES2022",
"moduleResolution": "Bundler",
"noEmit": true,
"noImplicitReturns": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2020",
},
"include": [".eslintrc.cjs", "prettier.config.js"],
}
+5 -1
View File
@@ -1,3 +1,7 @@
{
"$schema": "https://turbo.build/schema.json"
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"lint": {},
"format": {}
}
}