Add code formatting

This commit is contained in:
Krzysztof Wolski 2022-07-20 12:44:10 +02:00
parent c0c3c85bab
commit e535b66b4a
5 changed files with 1593 additions and 2 deletions

58
.eslintrc Normal file
View file

@ -0,0 +1,58 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"airbnb",
"plugin:@typescript-eslint/recommended",
"prettier" // prettier *has* to be the last one, to avoid conflicting rules
],
"ignorePatterns": ["pnpm-lock.yaml"],
"plugins": ["simple-import-sort", "@typescript-eslint"],
"rules": {
"quotes": ["error", "double"],
"react/react-in-jsx-scope": "off", // next does not require react imports
"import/extensions": "off", // file extension not required when importing
"react/jsx-filename-extension": "off",
"no-restricted-syntax": "off",
"no-underscore-dangle": "off",
"no-await-in-loop": "off",
"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off",
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
"import/first": "warn",
"import/newline-after-import": "warn",
"import/no-duplicates": "warn",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error"],
"@typescript-eslint/ban-types": "off",
"no-console": [
"error",
{
"allow": ["warn", "error", "debug"]
}
],
"no-continue": "off",
"operator-linebreak": "off",
"max-len": "off",
"array-callback-return": "off",
"implicit-arrow-linebreak": "off",
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"no-restricted-imports": "off",
"no-restricted-exports": "off",
"@typescript-eslint/ban-ts-comment": "off",
// TO FIX:
"import/no-cycle": "off", // pathpidia issue
"import/prefer-default-export": "off"
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
}
}
}
}

5
.prettierignore Normal file
View file

@ -0,0 +1,5 @@
.next
saleor/api.tsx
pnpm-lock.yaml
graphql.schema.json
lib/$path.ts

4
.prettierrc Normal file
View file

@ -0,0 +1,4 @@
{
"singleQuote": false,
"printWidth": 100
}

View file

@ -9,7 +9,8 @@
"watch": "tsc -w",
"build": "tsup-node src/* --format esm,cjs --dts && clear-package-json package.json -o dist/package.json --fields publishConfig",
"test": "uvu -r tsm spec",
"test-watch": "watchlist src spec -- pnpm test"
"test-watch": "watchlist src spec -- pnpm test",
"lint": "prettier --loglevel warn --write . && eslint --fix ."
},
"keywords": [],
"author": "",
@ -21,8 +22,20 @@
"retes": "^0.29.4"
},
"devDependencies": {
"clean-publish": "^4.0.1",
"@types/node": "^18.0.4",
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/parser": "^5.17.0",
"clean-publish": "^4.0.1",
"eslint": "8.15.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.3.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.0",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"prettier": "2.6.2",
"tsm": "^2.2.1",
"tsup": "^6.1.3",
"typescript": "^4.7.4",

File diff suppressed because it is too large Load diff