Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .lintstagedrc.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const path = require('path');

const FLAT_CONFIG_WORKSPACES = [
const SCOPED_WORKSPACES = [
'e2e',
'apps/admin'
'apps/admin',
'apps/posts',
'apps/shade'
];

function normalize(file) {
Expand Down Expand Up @@ -44,11 +46,11 @@ function buildRootEslintCommand(files) {

module.exports = {
'*.{js,ts,tsx,jsx,cjs}': (files) => {
const workspaceGroups = new Map(FLAT_CONFIG_WORKSPACES.map(workspace => [workspace, []]));
const workspaceGroups = new Map(SCOPED_WORKSPACES.map(workspace => [workspace, []]));
const rootFiles = [];

for (const file of files) {
const workspace = FLAT_CONFIG_WORKSPACES.find(candidate => isInWorkspace(file, candidate));
const workspace = SCOPED_WORKSPACES.find(candidate => isInWorkspace(file, candidate));

if (workspace) {
workspaceGroups.get(workspace).push(file);
Expand All @@ -58,7 +60,7 @@ module.exports = {
}

return [
...FLAT_CONFIG_WORKSPACES
...SCOPED_WORKSPACES
.map(workspace => buildScopedEslintCommand(workspace, workspaceGroups.get(workspace)))
.filter(Boolean),
buildRootEslintCommand(rootFiles)
Expand Down
Loading