unicorn/no-empty-file
eslint-plugin-unicorn
No autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-empty-file": "error",
},
},
];// Comment/* Comment */'use strict';const x = 0;'use strict';
const x = 0;;;
const x = 0;Examples from the ESLint documentation.
unicorn/no-empty-file
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-empty-file": "error",
},
},
];unicorn/no-empty-file
unicorn plugin · correctness
{
"rules": {
"unicorn/no-empty-file": "error"
}
}suspicious/noEmptySource
suspicious · since 2.2.7
{
"linter": {
"rules": {
"suspicious": {
"noEmptySource": "error"
}
}
}
}Prefer String#startsWith() & String#endsWith() over regexes, String#indexOf() === 0, and slice checks.
Disallow awaiting non-promise values.
Prefer using Set#size instead of Array#length.
Disallow useless array length check.