Skip to content

feat: Create new rule - validate-sheriff-config#179

Open
tomwhite007 wants to merge 39 commits into
softarc-consulting:mainfrom
tomwhite007:feature/add-new-lint-rule-for-sheriff.config.ts-only
Open

feat: Create new rule - validate-sheriff-config#179
tomwhite007 wants to merge 39 commits into
softarc-consulting:mainfrom
tomwhite007:feature/add-new-lint-rule-for-sheriff.config.ts-only

Conversation

@tomwhite007
Copy link
Copy Markdown
Contributor

@tomwhite007 tomwhite007 commented Feb 18, 2025

This PR introduces a new eslint rule, validate-sheriff-config. This new rule has its own createSheriffConfigRule function, similar to the createRule function used to generate the other rules. If you wish, I could look at merging the two. I didn’t do this before because I didn’t want to make many changes in createRule in this PR.

I’ve taken care not to change the way the user configures Sheriff in the eslint.config.js file.

To remain backwards compatible and not require significant extra eslint config from the user, I’ve introduced programmatic filename filters with a function, isExcluded.

I’ve added lots of tests to cover all changes.

@rainerhahnekamp
Copy link
Copy Markdown
Collaborator

Hey Tom, I see this PR is in draft mode and you had some commits lately. Let me know once it is ready for a review.

Comment thread .cursor/mcp.json
"url": "http://localhost:9378/sse"
}
}
} No newline at end of file
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might like to consider this change separately from the pr; it's just for the Cursor.

"@angular-eslint/schematics"
]
"schematicCollections": ["@angular-eslint/schematics"],
"analytics": false
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file has been formatted because I wanted to add "analytics": false

"@angular-eslint/schematics"
]
"schematicCollections": ["@angular-eslint/schematics"],
"analytics": false
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file has been formatted because I wanted to add "analytics": false

"@angular-eslint/schematics"
]
"schematicCollections": ["@angular-eslint/schematics"],
"analytics": false
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file has been formatted because I wanted to add "analytics": false

"@angular-eslint/schematics"
]
"schematicCollections": ["@angular-eslint/schematics"],
"analytics": false
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file has been formatted because I wanted to add "analytics": false

export const config: SheriffConfig = {
version: 1,
tagging: {
modules: {
Copy link
Copy Markdown
Contributor Author

@tomwhite007 tomwhite007 Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discuss: Are you happy with this change to the test scenario?

Comment thread test-projects/typescript-i/configs/eslint.config.js Outdated
Comment thread packages/eslint-plugin/src/lib/configs/all.ts Outdated
@tomwhite007 tomwhite007 marked this pull request as ready for review April 15, 2025 10:08
@tomwhite007
Copy link
Copy Markdown
Contributor Author

This one's now ready for review @rainerhahnekamp

@tomwhite007 tomwhite007 changed the title feat: add sheriffConfig as configArray feat: Create new rule - validate-sheriff-config Apr 15, 2025
};

const getProjectRoot = (filename: string): string =>
filename.slice(0, filename.indexOf(SHERIFF_CONFIG_FILENAME));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. During manual testing today, I discovered this line is not compatible with Windows file systems.

I'm flipping this PR back to draft while I fix it.

@tomwhite007 tomwhite007 marked this pull request as draft April 17, 2025 12:56
@sonarqubecloud
Copy link
Copy Markdown

@tomwhite007
Copy link
Copy Markdown
Contributor Author

I've fixed the Windows-projectRoot path issue, and I'm marking this PR ready for review again.

I have been looking at creating a Windows version for run-integration-tests.sh, but it's taking a while, and I don't want to slow this PR.

@tomwhite007 tomwhite007 marked this pull request as ready for review April 20, 2025 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants