eslint-formatting-reporter
v0.0.0
Published
Report differences between the formatted and unformatted code for ESLint.
Downloads
170,366
Readme
eslint-formatting-reporter
Report differences between the formatted and unformatted code for ESLint. Useful to create ESLint plugins that format plain code.
A thin wrapper around prettier-linter-helpers, extracted from eslint-plugin-prettier.
Usage
import { messages, reportDifferences } from 'eslint-formatting-reporter'
import type { Rule } from 'eslint'
// New ESLint Rule
export default <Rule.RuleModule>{
meta: {
type: 'layout',
fixable: 'whitespace',
messages
},
create(context) {
return {
Program() {
const source = context.source.text
const formatted = myFormat(source)
reportDifferences(context, source, formatted)
}
}
}
}
Sponsors
License
MIT License © 2023-PRESENT Anthony Fu