2023-04-19 20:41:22 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
|
|
|
const fs = require("fs")
|
|
|
|
|
|
2023-03-25 16:53:07 +01:00
|
|
|
module.exports = {
|
2023-04-19 20:41:22 +02:00
|
|
|
extends: [
|
|
|
|
|
"next",
|
|
|
|
|
"prettier",
|
|
|
|
|
"react-app",
|
|
|
|
|
"react-app/jest",
|
|
|
|
|
"plugin:@typescript-eslint/recommended",
|
|
|
|
|
"plugin:storybook/recommended",
|
2023-06-04 23:55:24 +02:00
|
|
|
"plugin:tailwindcss/recommended",
|
2023-04-19 20:41:22 +02:00
|
|
|
],
|
|
|
|
|
parserOptions: {
|
|
|
|
|
babelOptions: {
|
|
|
|
|
presets: [require.resolve("next/babel")],
|
2023-03-25 16:53:07 +01:00
|
|
|
},
|
|
|
|
|
},
|
2023-04-19 20:41:22 +02:00
|
|
|
rules: {
|
|
|
|
|
"testing-library/prefer-screen-queries": "off",
|
|
|
|
|
"@next/next/no-html-link-for-pages": "off",
|
|
|
|
|
"@typescript-eslint/no-unused-vars": [
|
|
|
|
|
"warn",
|
|
|
|
|
{
|
|
|
|
|
argsIgnorePattern: "^_",
|
|
|
|
|
varsIgnorePattern: "^_",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
"sort-imports": [
|
|
|
|
|
"error",
|
|
|
|
|
{
|
|
|
|
|
ignoreCase: true,
|
|
|
|
|
ignoreDeclarationSort: true,
|
|
|
|
|
},
|
|
|
|
|
],
|
2023-06-04 23:55:24 +02:00
|
|
|
"tailwindcss/classnames-order": "off",
|
2023-04-19 20:41:22 +02:00
|
|
|
"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()
|
|
|
|
|
})
|
|
|
|
|
}
|