Skip to content

Commit

Permalink
move new-cap from formatting to general rules, plus additional except…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Oct 22, 2024
1 parent 09c23f8 commit b6d63d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 9 additions & 0 deletions eslint/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ module.exports = {
'self'
],

// require a capital letter for constructors
'new-cap': [ 'error', {
newIsCap: true,
newIsCapExceptionPattern: '^(options|this|window)\\.\\w+', // Allow constructors to be passed through options.
newIsCapExceptions: [ 'rsync', 'jimp', 'Math.seedrandom' ],
capIsNew: false,
capIsNewExceptions: [ 'Immutable.Map', 'Immutable.Set', 'Immutable.List' ]
} ],

// don't escape characters that don't need to be escaped
'no-useless-escape': 2,

Expand Down
8 changes: 0 additions & 8 deletions eslint/format_eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,6 @@ module.exports = {
// TODO: enable?
'multiline-ternary': [ 'off', 'never' ],

// require a capital letter for constructors
'new-cap': [ 'error', {
newIsCap: true,
newIsCapExceptions: [],
capIsNew: false,
capIsNewExceptions: [ 'Immutable.Map', 'Immutable.Set', 'Immutable.List' ]
} ],

// disallow the omission of parentheses when invoking a constructor with no arguments
// https://eslint.org/docs/rules/new-parens
'new-parens': 'error',
Expand Down

0 comments on commit b6d63d4

Please sign in to comment.