next-enterprise/.eslintrc.js

80 lines
1.9 KiB
JavaScript
Raw Normal View History

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:storybook/recommended",
"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: {
2023-11-25 18:17:44 +01:00
"tailwindcss/no-custom-classname": "off",
2023-04-19 20:41:22 +02:00
"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,
},
],
"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()
})
}