@masknet/eslint-plugin
Version:
eslint plugin for masknet
22 lines (20 loc) • 553 B
text/typescript
import module from './prefer-location-assign.ts'
import { tester } from '../../spec.ts'
tester.test(module, {
invalid: [
{
code: "window.location = ''",
output: "window.location.assign('')",
errors: [{ messageId: 'instead' }],
},
{
code: "window.location.href = ''",
output: "window.location.assign('')",
errors: [{ messageId: 'instead', data: { name: 'href' } }],
},
{
code: 'window.location.port = 8080',
errors: [{ messageId: 'instead', data: { name: 'port' } }],
},
],
})