Skip to content

Commit ba57494

Browse files
authored
extend prop-name-casing to ignore specific names
1 parent b1fa3b9 commit ba57494

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/rules/prop-name-casing.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const allowedCaseOptions = ['camelCase', 'snake_case']
1515
/** @param {RuleContext} context */
1616
function create(context) {
1717
const options = context.options[0]
18+
const ignores = context.options[1]?.ignores || []
1819
const caseType = allowedCaseOptions.includes(options) ? options : 'camelCase'
1920
const checker = casing.getChecker(caseType)
2021

@@ -27,7 +28,7 @@ function create(context) {
2728
if (propName == null) {
2829
continue
2930
}
30-
if (!checker(propName)) {
31+
if (!checker(propName) || ignores.includes(propName)) {
3132
context.report({
3233
node: item.node,
3334
messageId: 'invalidCase',
@@ -64,6 +65,12 @@ module.exports = {
6465
schema: [
6566
{
6667
enum: allowedCaseOptions
68+
},
69+
{
70+
type: 'object',
71+
properties: {
72+
ignores: { type: 'array' }
73+
}
6774
}
6875
],
6976
messages: {

0 commit comments

Comments
 (0)