Skip to content
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