Skip to content

Commit 81ec635

Browse files
chrisbobbegnprice
authored andcommitted
eslint: Use "onlyDeclarations": true in rule id-match
And take advantage of this in the one existing spot where this is applicable.
1 parent d6bad18 commit 81ec635

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

.eslintrc.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,20 @@ rules:
208208
# [1]: https://github.com/tc39/proposal-class-fields
209209
no-underscore-dangle: ["error", { allowAfterThis: true } ]
210210

211-
# Disallow double underscores and trailing underscores.
212-
id-match: ["error", "^_?([a-zA-Z0-9$]+_?)*$", { "properties": true }]
211+
# Disallow names with double underscores and trailing underscores.
212+
id-match:
213+
- error
214+
- "^_?([a-zA-Z0-9$]+_?)*$"
215+
- # Don't apply to property names; see comment on no-underscore-dangle.
216+
properties: true
217+
218+
# Only apply to declarations, not uses. That way a local override for
219+
# a given name only needs to appear once, not at each use.
220+
#
221+
# The docs (https://eslint.org/docs/latest/rules/id-match) say this
222+
# only applies to `var`, `function`, and `class` declarations, but in
223+
# fact it seems to correctly apply to `const` and other declarations.
224+
onlyDeclarations: true
213225

214226

215227
#

src/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* @flow strict-local */
2-
/* eslint-disable id-match */
2+
// eslint-disable-next-line id-match
33
import type { ____Styles_Internal } from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
44

55
import composeBoxStyles from './composeBoxStyles';

0 commit comments

Comments
 (0)