Skip to content

Commit 2a6bec1

Browse files
Cosmic-Ryverljharb
andcommitted
[eslint config] [base] [patch] Improve function-paren-newline with multiline-arguments option
Related to airbnb#1731 Co-authored-by: Augustus Buonviri <[email protected]> Co-authored-by: Jordan Harband <[email protected]>
1 parent 82dbec3 commit 2a6bec1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/eslint-config-airbnb-base/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"dependencies": {
7575
"confusing-browser-globals": "^1.0.10",
7676
"object.assign": "^4.1.2",
77-
"object.entries": "^1.1.4"
77+
"object.entries": "^1.1.4",
78+
"semver": "^6.3.0"
7879
}
7980
}

packages/eslint-config-airbnb-base/rules/style.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
const semver = require('semver');
2+
const eslintPkg = require('eslint/package.json');
3+
14
module.exports = {
25
rules: {
36
// enforce line breaks after opening and before closing array brackets
@@ -101,9 +104,9 @@ module.exports = {
101104
// TODO: enable
102105
'func-style': ['off', 'expression'],
103106

104-
// enforce consistent line breaks inside function parentheses
107+
// require line breaks inside function parentheses if there are line breaks between parameters
105108
// https://eslint.org/docs/rules/function-paren-newline
106-
'function-paren-newline': ['error', 'consistent'],
109+
'function-paren-newline': ['error', semver.satisfies(eslintPkg.version, '>= 6') ? 'multiline-arguments' : 'consistent'],
107110

108111
// Blacklist certain identifiers to prevent them being used
109112
// https://eslint.org/docs/rules/id-blacklist

0 commit comments

Comments
 (0)