Skip to content

Add ignoreProps option to vue/prop-name-casing #2679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 20, 2025
Merged
Changes from 1 commit
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
9 changes: 8 additions & 1 deletion lib/rules/prop-name-casing.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const allowedCaseOptions = ['camelCase', 'snake_case']
/** @param {RuleContext} context */
function create(context) {
const options = context.options[0]
const ignores = context.options[1]?.ignores || []
const caseType = allowedCaseOptions.includes(options) ? options : 'camelCase'
const checker = casing.getChecker(caseType)

Expand All @@ -27,7 +28,7 @@ function create(context) {
if (propName == null) {
continue
}
if (!checker(propName)) {
if (!checker(propName) || ignores.includes(propName)) {
context.report({
node: item.node,
messageId: 'invalidCase',
Expand Down Expand Up @@ -64,6 +65,12 @@ module.exports = {
schema: [
{
enum: allowedCaseOptions
},
{
type: 'object',
properties: {
ignores: { type: 'array' }
}
}
],
messages: {
Expand Down