import type { TSESTree , TSESLint } from '@typescript-eslint/experimental-utils' ; import docsUrl from '../utils/docs-url' ; const rule = { meta : { messages : { removeNestedSwitch : 'Refactor the code to eliminate this nested "switch".' , } , schema : [ ] , type : 'suggestion' , docs : { description : '"switch" statements should not be nested' , recommended : 'error' , url : docsUrl ( __filename ) , } , } , create ( context ) { return { 'SwitchStatement SwitchStatement' : ( node ) => { const switchToken = context . getSourceCode ( ) . getFirstToken ( node , token => token . value === 'switch' ) ; context . report ( { messageId : 'removeNestedSwitch' , loc : switchToken ! . loc , } ) ; } , } ; } , } ; export = rule ;