Skip to content

Commit

Permalink
chore: Fix lint in module files
Browse files Browse the repository at this point in the history
  • Loading branch information
javierbrea committed Nov 5, 2024
1 parent 66bd877 commit 829a372
Showing 1 changed file with 176 additions and 130 deletions.
306 changes: 176 additions & 130 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,161 +6,207 @@ import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const _filename = fileURLToPath(import.meta.url);
const _dirname = path.dirname(_filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
baseDirectory: _dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [...compat.extends("prettier"), {
ignores: ["eslint.config.mjs"],
},
{
export default [
...compat.extends("prettier"),
{
plugins: {
prettier,
"local-rules": localRules,
prettier,
"local-rules": localRules,
},

languageOptions: {
globals: {
...globals.node,
},
globals: {
...globals.node,
},

ecmaVersion: 2022,
sourceType: "commonjs",
ecmaVersion: 2022,
sourceType: "commonjs",
},

rules: {
"prettier/prettier": ["error", {
printWidth: 99,
parser: "flow",
}],

"no-shadow": [2, {
builtinGlobals: true,
hoist: "all",
}],

"no-undef": "error",

"no-unused-vars": ["error", {
vars: "all",
args: "after-used",
ignoreRestSiblings: false,
}],
"prettier/prettier": [
"error",
{
printWidth: 99,
parser: "flow",
},
],

"no-shadow": [
2,
{
builtinGlobals: true,
hoist: "all",
},
],

"no-undef": "error",

"no-unused-vars": [
"error",
{
vars: "all",
args: "after-used",
ignoreRestSiblings: false,
},
],
},
}, {
},
{
files: ["**/*.mjs"],
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
},
},
{
files: ["src/**/*.js"],

settings: {
"boundaries/dependency-nodes": ["require", "import", "dynamic-import", "export"],

"boundaries/elements": [{
type: "config",
mode: "file",
pattern: ["src/configs/*.js", "(package.json)"],
capture: ["name"],
}, {
type: "constants",
mode: "file",
pattern: "src/constants/*.js",
capture: ["name"],
}, {
type: "core",
mode: "file",
pattern: "src/core/*.js",
capture: ["name"],
}, {
type: "helper",
mode: "file",
pattern: "src/helpers/*.js",
capture: ["name"],
}, {
type: "rule",
mode: "file",
pattern: "src/rules/*.js",
capture: ["name"],
}, {
type: "rule-factory",
mode: "file",
pattern: "src/rules-factories/*.js",
capture: ["name"],
}, {
type: "plugin",
mode: "full",
pattern: ["src/index.js"],
}],
"boundaries/dependency-nodes": ["require", "import", "dynamic-import", "export"],

"boundaries/elements": [
{
type: "config",
mode: "file",
pattern: ["src/configs/*.js", "(package.json)"],
capture: ["name"],
},
{
type: "constants",
mode: "file",
pattern: "src/constants/*.js",
capture: ["name"],
},
{
type: "core",
mode: "file",
pattern: "src/core/*.js",
capture: ["name"],
},
{
type: "helper",
mode: "file",
pattern: "src/helpers/*.js",
capture: ["name"],
},
{
type: "rule",
mode: "file",
pattern: "src/rules/*.js",
capture: ["name"],
},
{
type: "rule-factory",
mode: "file",
pattern: "src/rules-factories/*.js",
capture: ["name"],
},
{
type: "plugin",
mode: "full",
pattern: ["src/index.js"],
},
],
},

rules: {
"local-rules/boundaries/element-types": [2, {
default: "disallow",

rules: [{
from: "plugin",
allow: ["constants", "config", "rule"],
}, {
from: "config",
allow: ["constants", "config"],
}, {
from: "constants",
allow: ["constants"],
}, {
from: "core",
allow: ["constants", "helper", "core"],
}, {
from: "helper",
allow: ["constants", "helper"],
}, {
from: "rule",
allow: ["constants", "helper", "core", "rule-factory"],
}, {
from: "rule-factory",
allow: ["constants", "helper", "core"],
}],
}],

"local-rules/boundaries/no-unknown": [2],
"local-rules/boundaries/no-unknown-files": [2],
},
}, {
"local-rules/boundaries/element-types": [
2,
{
default: "disallow",

rules: [
{
from: "plugin",
allow: ["constants", "config", "rule"],
},
{
from: "config",
allow: ["constants", "config"],
},
{
from: "constants",
allow: ["constants"],
},
{
from: "core",
allow: ["constants", "helper", "core"],
},
{
from: "helper",
allow: ["constants", "helper"],
},
{
from: "rule",
allow: ["constants", "helper", "core", "rule-factory"],
},
{
from: "rule-factory",
allow: ["constants", "helper", "core"],
},
],
},
],

"local-rules/boundaries/no-unknown": [2],
"local-rules/boundaries/no-unknown-files": [2],
},
},
{
files: ["test/src/**/*.js"],

plugins: {
prettier
prettier,
},

languageOptions: {
globals: {
...globals.node,
describe: "readonly",
it: "readonly",
expect: "readonly",
},

ecmaVersion: 2022,
sourceType: "commonjs",
globals: {
...globals.node,
describe: "readonly",
it: "readonly",
expect: "readonly",
},

ecmaVersion: 2022,
sourceType: "commonjs",
},

rules: {
"prettier/prettier": ["error", {
printWidth: 99,
parser: "flow",
}],

"no-shadow": [2, {
builtinGlobals: true,
hoist: "all",
}],

"no-undef": "error",

"no-unused-vars": ["error", {
vars: "all",
args: "after-used",
ignoreRestSiblings: false,
}],
"prettier/prettier": [
"error",
{
printWidth: 99,
parser: "flow",
},
],

"no-shadow": [
2,
{
builtinGlobals: true,
hoist: "all",
},
],

"no-undef": "error",

"no-unused-vars": [
"error",
{
vars: "all",
args: "after-used",
ignoreRestSiblings: false,
},
],
},
}];
},
];

0 comments on commit 829a372

Please sign in to comment.