1.0.0 • Published 12 months ago

@mahdi.golzar/autolinter v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

AutoLinter

AutoLinter is a simple tool for automatically linting and fixing your code. It allows you to define custom linting rules that can automatically detect and correct common code issues.

Features

  • Custom Linting Rules: Define and apply your own linting rules.
  • Automatic Code Correction: Automatically fixes code based on the defined rules.
  • File Linting: Lint and fix entire files with ease.

Installation

No installation is required for this code as it is self-contained and can be added directly to your project.

Usage

  1. Create an AutoLinter Instance
    const linter = new AutoLinter();
  2. Define Linting Rules Add custom linting rules using the addRule method:
linter.addRule({
pattern: /var\s+/g,
replacement: 'let ',
});

linter.addRule({
pattern: /==/g,
replacement: '===',
});
  1. Lint and Fix Code Use the lint method to lint and fix a string of code:
const lintedCode = linter.lint(sampleCode);
console.log("Linted Code:\n", lintedCode);
  1. Lint and Fix Files Lint and fix an entire file using the lintFile method:
linter.lintFile('./path/to/your/file.js');
1.0.0

12 months ago