Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comma-dangle: only-multiline does not report dangling comma after rest parameters #804

Open
salik1992 opened this issue Oct 16, 2019 · 1 comment

Comments

@salik1992
Copy link

@salik1992 salik1992 commented Oct 16, 2019

Environment
babel-eslint: v8.2.6
ESLint version: v6.5.1
Node version: v12.11.1
npm version: v6.11.3

ESLint config

module.exports = {
    parser: 'babel-eslint',
    extends: [
        'airbnb',
    ],
    env: {
        node: true,
        browser: true,
        es6: true,
        jest: true,
        mocha: true
    },
    parserOptions: {
        ecmaFeatures: {
            experimentalObjectRestSpread: true
        }
    },
    plugins: [
        'jest',
        'detox',
        'mocha'
    ],
    rules: {
        'arrow-body-style': ['warn', 'as-needed'],
        camelcase: 'off',
        'class-methods-use-this': 'off',
        indent: ['error', 4],
        'max-statements': ['warn', 20],
        'new-cap': ['error', { capIsNew: false }],
        'no-duplicate-imports': 'off',
        'no-param-reassign': ['error', { ignorePropertyModificationsFor: ['el', 'ref', 'event'] }],
        'no-plusplus': 'off',
        'no-shadow': ['error', { builtinGlobals: false, hoist: 'functions', allow: ['describe'] }],
        'react/jsx-filename-extension': ['error', { extensions: ['.js'] }],
        'react/jsx-indent': ['error', 4],
        'react/jsx-indent-props': ['error', 4],
        'react/require-extension': 'off',
        'react/sort-comp': [
            'error',
            {
                order: [
                    'type-annotations',
                    'static-methods',
                    'lifecycle',
                    '/^on.+$/',
                    '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
                    'everything-else',
                    '/^render.+$/',
                    'render'
                ]
            }
        ],
        'object-curly-newline': ['error', {
            ObjectExpression: { minProperties: 6, multiline: true, consistent: true },
            ObjectPattern: { minProperties: 6, multiline: true, consistent: true }
        }],

        'import/prefer-default-export': 'off',
        'import/no-extraneous-dependencies': 'off',
        'import/no-duplicates': 'error',
        'import/no-named-as-default': 'off',

        'jsx-a11y/no-static-element-interactions': 'off',
        'jsx-a11y/no-noninteractive-tabindex': 'off',
        'jsx-a11y/media-has-caption': 'off',
        'jsx-a11y/mouse-events-have-key-events': 'off',

        'comma-dangle': ['error', 'only-multiline'],

        'mocha/no-exclusive-tests': 'error'
    },
};

Code example

const Container = ({
    width,
    height,
    ...props,
}) => (
    // JSX body
);

Expected to happen
The comma after ...props should be handled as an error Unexpected trailing comma as it does for always-multiline setting.

What happened
With only-multiline setting the code passes without an error.

Originally the issue has been opened in eslint repository (eslint/eslint#12435), but they say it should be in this repository.

@nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Oct 16, 2019

Since that is a syntax error, it's a Bug with @babel/parser.

The good news is that it has been fixed a few days ago in v7.6.4 😛
babel/babel@34937f1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.