<commit_before>/**
 * @fileoverview Warns against using the deprecated, double-dash style for BEM
 * notation. See:
 * https://releasenotes.docs.salesforce.com/en-us/summer17/release-notes/rn_lds.htm.
 * @author <NAME>
 */

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

const rule = require('../../../lib/rules/no-double-dash-modifier');
// eslint-disable-next-line import/no-extraneous-dependencies
const RuleTester = require('eslint').RuleTester;

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

const parserOptions = {
	ecmaVersion: 6,
	ecmaFeatures: {
		jsx: true,
	},
};

const ruleTester = new RuleTester();
ruleTester.run('no-double-dash-modifier', rule, {
	valid: [
		{
			code: '<div className="slds-p-around_medium"/>',
			parserOptions,
		},
		{
			code: '<div className="slds-p-around_medium slds-m-around_medium"/>',
			parserOptions,
		},
		{
			code: '<div className="some-other-bem--modifier"/>',
			parserOptions,
		},
	],

	invalid: [
		{
			code: '<div className="slds-p-around--medium"/>',
			errors: [
				{
					message:
						'SLDS modifier CSS classes should use a single ' +
						'underscore instead of double-hyphen: ' +
						'"slds-p-around--medium".',
				},
			],
			parserOptions,
		},
		{
			code: '<div className="slds-p-around--medium slds-m-around--medium"/>',
			errors: [
				{
					message:
						'SLDS modifier CSS classes should use a single ' +
						'underscore instead of double-hyphen: ' +
						'"slds-p-around--medium", "slds-m-around--medium".',
				},
			],
			parserOptions,
		},
		{
			code:
				'<div className="another-class slds-p-around--medium and-another"/>',
			errors: [
				{
					message:
						'SLDS modifier CSS classes should use a single ' +
						'underscore instead of double-hyphen: ' +
						'"slds-p-around--medium".',
				},
			],
			parserOptions,
		},
	],
});<commit_msg>Add tests for template literals<commit_after>/**
 * @fileoverview Warns against using the deprecated, double-dash style for BEM
 * notation. See:
 * https://releasenotes.docs.salesforce.com/en-us/summer17/release-notes/rn_lds.htm.
 * @author <NAME>
 */

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

const rule = require('../../../lib/rules/no-double-dash-modifier');
// eslint-disable-next-line import/no-extraneous-dependencies
const RuleTester = require('eslint').RuleTester;

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

const parserOptions = {
	ecmaVersion: 6,
	ecmaFeatures: {
		jsx: true,
	},
};

const ruleTester = new RuleTester();
ruleTester.run('no-double-dash-modifier', rule, {
	valid: [
		{
			code: '<div className="slds-p-around_medium"/>',
			parserOptions,
		},
		{
			code: '<div className="slds-p-around_medium slds-m-around_medium"/>',
			parserOptions,
		},
		{
			code: '<div className="some-other-bem--modifier"/>',
			parserOptions,
		},
		{
			code: '<div className={`slds-button_icon-${iconVariant}`}/>',
			parserOptions,
		},
		{
			code: '<div className={`slds-dropdown_${position}`}/>',
			parserOptions,
		},
	],

	invalid: [
		{
			code: '<div className="slds-p-around--medium"/>',
			errors: [
				{
					message:
						'SLDS modifier CSS classes should use a single ' +
						'underscore instead of double-hyphen: ' +
						'"slds-p-around--medium".',
				},
			],
			parserOptions,
		},
		{
			code: '<div className="slds-p-around--medium slds-m-around--medium"/>',
			errors: [
				{
					message:
						'SLDS modifier CSS classes should use a single ' +
						'underscore instead of double-hyphen: ' +
						'"slds-p-around--medium", "slds-m-around--medium".',
				},
			],
			parserOptions,
		},
		{
			code:
				'<div className="another-class slds-p-around--medium and-another"/>',
			errors: [
				{
					message:
						'SLDS modifier CSS classes should use a single ' +
						'underscore instead of double-hyphen: ' +
						'"slds-p-around--medium".',
				},
			],
			parserOptions,
		},
		{
			code: '{[`slds-button__icon--${props.size}`]}',
			errors: [
				{
					message:
						'SLDS modifier CSS classes should use a single ' +
						'underscore instead of double-hyphen: ' +
						'"slds-button__icon--".',
				},
			],
			parserOptions,
		},
		{
			code: '<div className={`slds-button--icon-${iconVariant}`}/>',
			errors: [
				{
					message:
						'SLDS modifier CSS classes should use a single ' +
						'underscore instead of double-hyphen: ' +
						'"slds-button--icon-".',
				},
			],
			parserOptions,
		},
		{
			code: '<div className={`slds-dropdown--${position}`}/>',
			errors: [
				{
					message:
						'SLDS modifier CSS classes should use a single ' +
						'underscore instead of double-hyphen: ' +
						'"slds-dropdown--".',
				},
			],
			parserOptions,
		},
	],
});
{'fraction_non_alphanumeric': 0.27634615384615385, 'fraction_numerical': 0.001153846153846154, 'mean_word_length': 1.7547669491525424, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '527887', 'n_tokens_mistral': 2042, 'n_tokens_neox': 1624, 'n_words': 298}