Skip to content

Commit

Permalink
Fix after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
yassin-kammoun-sonarsource committed Jun 29, 2021
1 parent 320ff60 commit e0c4ac4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 7 additions & 4 deletions src/rules/no-nested-template-literals.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* eslint-plugin-sonarjs
* Copyright (C) 2018 SonarSource SA
* Copyright (C) 2018-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand All @@ -19,15 +19,18 @@
*/
// https://jira.sonarsource.com/browse/RSPEC-4624

import { Rule } from 'eslint';
import * as estree from 'estree';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { Rule } from '../utils/types';

const message = 'Refactor this code to not use nested template literals.';

const rule: Rule.RuleModule = {
meta: {
type: 'suggestion',
},
create(context: Rule.RuleContext) {
return {
'TemplateLiteral TemplateLiteral': (node: estree.Node) => {
'TemplateLiteral TemplateLiteral': (node: TSESTree.Node) => {
context.report({
message,
node,
Expand Down
6 changes: 2 additions & 4 deletions tests/rules/no-nested-template-literals.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* eslint-plugin-sonarjs
* Copyright (C) 2018 SonarSource SA
* Copyright (C) 2018-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand All @@ -19,11 +19,9 @@
*/

/* eslint-disable no-template-curly-in-string */
import { RuleTester } from 'eslint';
import { ruleTester } from '../rule-tester';
import * as rule from '../../src/rules/no-nested-template-literals';

const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 2018 } });

ruleTester.run('Template literals should not be nested', rule, {
valid: [
{
Expand Down

0 comments on commit e0c4ac4

Please sign in to comment.