Search code examples
javascripteslintjscs

requirePaddingNewLinesAfterUseStrict in ESLint


Now the JSCS project was merged with ESLint and the JSCS linter is deprecated I'm still having a hard time trying to figure out how to replace certain rules. Specifically, JSCS has this rule requirePaddingNewLinesAfterUseStrict that does what the name suggests: requires you to add a new line after "use strict". I've searched the ESLint rules but couldn't find an equivalent. Is there maybe a plugin that adds a similar rule to ESLint?


Solution

  • As of ESLint 3.5.0, you should be able to use the ESLint rule lines-around-directive to add new line after "use strict";

    In your .eslintrc file, add the following to the rules object:

    "lines-around-directive": "error",