chore: setup custom eslint config
This commit is contained in:
parent
59df8d9618
commit
910217b5d0
5 changed files with 3386 additions and 24 deletions
|
|
@ -15,6 +15,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint-config-custom": "*",
|
"eslint-config-custom": "*",
|
||||||
"prettier": "latest",
|
"prettier": "latest",
|
||||||
|
"prettier-plugin-tailwindcss": "^0.2.7",
|
||||||
"turbo": "latest"
|
"turbo": "latest"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,75 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: ["next", "turbo", "prettier"],
|
extends: [
|
||||||
rules: {
|
"next",
|
||||||
"@next/next/no-html-link-for-pages": "off",
|
"turbo",
|
||||||
},
|
"prettier",
|
||||||
|
"react-app",
|
||||||
|
"react-app/jest",
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
"plugin:storybook/recommended",
|
||||||
|
],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
babelOptions: {
|
babelOptions: {
|
||||||
presets: [require.resolve("next/babel")],
|
presets: [require.resolve("next/babel")],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
rules: {
|
||||||
|
"@next/next/no-html-link-for-pages": "off",
|
||||||
|
|
||||||
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
argsIgnorePattern: "^_",
|
||||||
|
varsIgnorePattern: "^_",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"sort-imports": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
ignoreCase: true,
|
||||||
|
ignoreDeclarationSort: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"import/order": [
|
||||||
|
1,
|
||||||
|
{
|
||||||
|
groups: ["external", "builtin", "internal", "sibling", "parent", "index"],
|
||||||
|
pathGroups: [
|
||||||
|
...getDirectoriesToSort().map((singleDir) => ({
|
||||||
|
pattern: `${singleDir}/**`,
|
||||||
|
group: "internal",
|
||||||
|
})),
|
||||||
|
{
|
||||||
|
pattern: "env",
|
||||||
|
group: "internal",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: "theme",
|
||||||
|
group: "internal",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: "public/**",
|
||||||
|
group: "internal",
|
||||||
|
position: "after",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
pathGroupsExcludedImportTypes: ["internal"],
|
||||||
|
alphabetize: {
|
||||||
|
order: "asc",
|
||||||
|
caseInsensitive: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDirectoriesToSort() {
|
||||||
|
const ignoredSortingDirectories = [".git", ".next", ".vscode", "node_modules"]
|
||||||
|
return getDirectories(process.cwd()).filter((f) => !ignoredSortingDirectories.includes(f))
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDirectories(path) {
|
||||||
|
return fs.readdirSync(path).filter(function (file) {
|
||||||
|
return fs.statSync(path + "/" + file).isDirectory()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,12 @@
|
||||||
"eslint-config-next": "13.0.0",
|
"eslint-config-next": "13.0.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"eslint-plugin-react": "7.31.8",
|
"eslint-plugin-react": "7.31.8",
|
||||||
"eslint-config-turbo": "latest"
|
"eslint-config-turbo": "latest",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
||||||
|
"@typescript-eslint/parser": "^5.54.1",
|
||||||
|
"eslint-config-react-app": "^7.0.1",
|
||||||
|
"eslint-plugin-import": "^2.27.5",
|
||||||
|
"eslint-plugin-storybook": "^0.6.11"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^4.7.4"
|
"typescript": "^4.7.4"
|
||||||
|
|
|
||||||
7
prettier.config.js
Normal file
7
prettier.config.js
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
module.exports = {
|
||||||
|
plugins: [require("prettier-plugin-tailwindcss")],
|
||||||
|
trailingComma: "es5",
|
||||||
|
tabWidth: 2,
|
||||||
|
printWidth: 120,
|
||||||
|
semi: false,
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue