Skip to content

Commit

Permalink
Add prettier, eslint + all exact version + change ast lib meriyah to …
Browse files Browse the repository at this point in the history
…acorn + fix bracket + lint

fix #14
  • Loading branch information
slofp committed Dec 29, 2023
1 parent 2cda18b commit 3e88215
Show file tree
Hide file tree
Showing 73 changed files with 2,027 additions and 854 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
vite.config.ts
**/*.ai.js
129 changes: 129 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:svelte/recommended", "plugin:prettier/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": "latest",
"sourceType": "module",
"extraFileExtensions": [".svelte"],
"ecmaFeatures": {
"globalReturn": false,
"impliedStrict": true
}
},
"plugins": ["@typescript-eslint"],
"overrides": [
{
"files": ["web/**/*.svelte"],
"parser": "svelte-eslint-parser",
"parserOptions": {
"parser": "@typescript-eslint/parser",
"project": "./web/tsconfig.json"
},
"rules": {
"brace-style": ["warn", "1tbs"]
}
},
{
"files": ["web/**/*.ts", "web/*.ts"],
"parserOptions": {
"project": "./web/tsconfig.json"
}
}
],
"rules": {
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/no-duplicate-enum-values": "error",
"@typescript-eslint/no-duplicate-type-constituents": "warn",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extra-non-null-assertion": "error",
"@typescript-eslint/no-misused-promises": [
"error",
{
"checksConditionals": false,
"checksSpreads": true,
"checksVoidReturn": false
}
],
"@typescript-eslint/no-for-in-array": "warn",
"no-implied-eval": "off",
"@typescript-eslint/no-implied-eval": "error",
"no-loss-of-precision": "off",
"@typescript-eslint/no-loss-of-precision": "warn",
"@typescript-eslint/no-redundant-type-constituents": "warn",
"@typescript-eslint/no-this-alias": [
"warn",
{
"allowDestructuring": true
}
],
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-declaration-merging": "error",
"@typescript-eslint/no-unsafe-enum-comparison": "warn",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"vars": "all",
"args": "all",
"ignoreRestSiblings": false,
"argsIgnorePattern": "_"
}
],
"@typescript-eslint/no-var-requires": "warn",
"@typescript-eslint/prefer-as-const": "warn",
"require-await": "off",
"@typescript-eslint/require-await": "error",
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/no-empty-interface": "error",
"no-empty-function": "off",
"@typescript-eslint/no-empty-function": [
"error",
{
"allow": [
"private-constructors",
"protected-constructors",
"constructors",
"decoratedFunctions",
"overrideMethods"
]
}
],
"no-dupe-class-members": "off",
"@typescript-eslint/no-dupe-class-members": "error",
"object-curly-newline": [
"error",
{
"ObjectExpression": { "multiline": true },
"ObjectPattern": { "multiline": true },
"ImportDeclaration": "never",
"ExportDeclaration": "never"
}
],
"brace-style": ["warn", "stroustrup"],
"lines-between-class-members": [
"error",
{
"enforce": [
{ "blankLine": "never", "prev": "field", "next": "field" },
{ "blankLine": "always", "prev": "*", "next": "*" }
]
}
],
"curly": "error",
"semi": ["error", "always"],
"prettier/prettier": "warn",
"no-undef": "off"
}
}
14 changes: 14 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.DS_Store
node_modules
dist
pnpm-lock.yaml
package.json
package-lock.json
pnpm-workspace.yaml
yarn.lock
tsconfig.json
tsconfig.node.json
.github
.vscode
**/*.ai.js
**/*.ai
28 changes: 28 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"printWidth": 150,
"tabWidth": 2,
"useTabs": true,
"semi": true,
"singleQuote": true,
"quoteProps": "as-needed",
"trailingComma": "es5",
"bracketSpacing": true,
"arrowParens": "always",
"svelteSortOrder": "options-scripts-markup-styles",
"svelteStrictMode": false,
"svelteAllowShorthand": true,
"svelteIndentScriptAndStyle": true,
"plugins": [
"prettier-plugin-svelte",
"prettier-plugin-brace-style"
],
"braceStyle": "stroustrup",
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"prettier.configPath": "./.prettierrc",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.validate": [
"javascript",
"typescript",
"svelte"
],
"[svelte][typescript]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
}
23 changes: 17 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,27 @@
],
"scripts": {
"test": "cd test && node index.js",
"build": "tsc"
"build": "tsc",
"lint": "eslint --ext .ts,.svelte .",
"fix": "eslint --ext .ts,.svelte --fix ."
},
"keywords": [],
"author": "",
"license": "",
"author": "(Fairy)Phy.Secineralyr",
"license": "MIT",
"devDependencies": {
"typescript": "^5.3.2"
"@prettier/sync": "0.3.0",
"@typescript-eslint/eslint-plugin": "6.16.0",
"@typescript-eslint/parser": "6.16.0",
"eslint": "8.56.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.1.2",
"prettier": "3.1.1",
"prettier-plugin-brace-style": "0.3.2",
"prettier-plugin-merge": "0.4.0",
"typescript": "5.3.2"
},
"dependencies": {
"meriyah": "^4.3.8",
"terser": "^5.24.0"
"acorn": "8.11.2",
"terser": "5.24.0"
}
}
Loading

0 comments on commit 3e88215

Please sign in to comment.