diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 02b7b2f..652c42c 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -33,6 +33,7 @@ jobs:
- 16
- 18
- 20
+ - 22
include:
- os: macos-latest
node-version: 20
diff --git a/README.md b/README.md
index 78f5c0e..bcb4de3 100644
--- a/README.md
+++ b/README.md
@@ -48,6 +48,8 @@ linting.on("done", () => {
console.log("You've been a naughty boy!");
}
});
+
+linting.lint();
```
## Config
diff --git a/bin/cli.js b/bin/cli.js
index f1aee90..84de543 100755
--- a/bin/cli.js
+++ b/bin/cli.js
@@ -130,6 +130,7 @@ process.on('exit', () => {
process.exit(EXIT_CODES.success);
}
});
+ linting.lint();
})
.catch((error) => {
logger.error('Failed to lint\n', error);
@@ -171,6 +172,7 @@ process.on('exit', () => {
onLintingDone();
});
+ linting.lint();
})
.catch((error) => {
logger.error('Failed to lint file', filePath, '\n', error);
diff --git a/src/lib/linting.js b/src/lib/linting.js
index b79af47..5ff5a08 100644
--- a/src/lib/linting.js
+++ b/src/lib/linting.js
@@ -58,8 +58,6 @@ class Linting extends EventEmitter {
this.results = {};
/** The logger used to show debugs */
this.logger = logging(`lint:${this.name}`);
-
- this.lint();
}
/**
diff --git a/test/api.spec.js b/test/api.spec.js
index a7110f8..c566e58 100644
--- a/test/api.spec.js
+++ b/test/api.spec.js
@@ -10,43 +10,51 @@ const svg = '';
describe('.lintSource()', function () {
it('should succeed without config', function (done) {
- SVGLint.lintSource(svg).then((result) => {
- result.on('done', () => {
- expect(result.state).toBe(result.STATES.success);
+ SVGLint.lintSource(svg).then((linting) => {
+ linting.on('done', () => {
+ expect(linting.state).toBe(linting.STATES.success);
done();
});
+ linting.lint();
});
});
it('should succeed with empty config', function (done) {
- SVGLint.lintSource(svg, {}).then((result) => {
- result.on('done', () => {
- expect(result.state).toBe(result.STATES.success);
+ SVGLint.lintSource(svg, {}).then((linting) => {
+ linting.on('done', () => {
+ expect(linting.state).toBe(linting.STATES.success);
done();
});
+ linting.lint();
});
});
it('should succeed with empty SVG', function (done) {
- SVGLint.lintSource(svg, {}).then((result) => {
- result.on('done', () => {
- expect(result.state).toBe(result.STATES.success);
+ SVGLint.lintSource(svg, {}).then((linting) => {
+ linting.on('done', () => {
+ expect(linting.state).toBe(linting.STATES.success);
done();
});
+ linting.lint();
});
});
it('should succeed with empty first line', function (done) {
- SVGLint.lintSource('\n' + svg, {}).then((result) => {
- result.on('done', () => {
- expect(result.state).toBe(result.STATES.success);
+ SVGLint.lintSource('\n' + svg, {}).then((linting) => {
+ linting.on('done', () => {
+ expect(linting.state).toBe(linting.STATES.success);
done();
});
+ linting.lint();
});
});
it('should throw with malformed SVG', function (done) {
- SVGLint.lintSource('