Skip to content

boolean-prop-naming is missing default config #1551

Open
@avaly

Description

@avaly

It seems that the boolean-prop-naming rule does not enforce any default config (especially for rule as the docs mention here)

Sample code:

import * as React from 'react';
import PropTypes from 'prop-types';

class ReactClassComponent extends React.Component {
	static propTypes = {
		error: PropTypes.bool,
		hasError: PropTypes.bool,
		isOptional: PropTypes.bool,
		optional: PropTypes.bool,
	};

	render() {
		return null;
	}
}

Sample eslint configuration:

	plugins: ['react'],
	rules: {
		'react/boolean-prop-naming': ['error'],
	},

Running eslint . gives no errors.

However switching the rule config to ['error', { rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+' }] will throw linting error for the sample code above.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions