eslint-plugin

@masknet/no-top-level

Disallow side-effect at module top-level

Rule Details

Don’t make side effect at top level.

Options

/**
 * @minItems Infinity
 */
export type Options = [
  {
    'variable'?: boolean
    'side-effect'?: boolean
  },
]

:x: Incorrect

console.log('bar')

:white_check_mark: Correct

function foo() {
  console.log('bar')
}

When Not To Use It

When you have to run side effects at the top level.

Attributes

Thanks

https://github.com/HKalbasi/eslint-plugin-toplevel