Skip to content

Commit

Permalink
build(config): add stylistic semi rule
Browse files Browse the repository at this point in the history
  • Loading branch information
adorade committed Oct 1, 2024
1 parent cb4b8f3 commit 0ac854e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ module.exports = {
'n/prefer-global/process': ['error', 'always']
},
overrides: [
{
files: [
'src/*.mjs',
'test/*.test.js'
],
rules: {
'@stylistic/js/semi': ['error', 'always'],
}
},
{
files: [
'test/*.test.js',
Expand Down
14 changes: 7 additions & 7 deletions src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default function gStylelintEsm(options) {
});

return pluginError;
}
};

/**
* Transforms the lint results into a single result object.
Expand Down Expand Up @@ -152,7 +152,7 @@ export default function gStylelintEsm(options) {

// Return the transformed result as a single-element array
return [combinedResult];
}
};

/**
* Passes lint results through user-defined reporters.
Expand All @@ -176,7 +176,7 @@ export default function gStylelintEsm(options) {

// Return the original lint results after passing through reporters
return lintResults;
}
};

/**
* Count of errors in lint results.
Expand Down Expand Up @@ -215,7 +215,7 @@ export default function gStylelintEsm(options) {
message: `Failed with ${errorCount} error${pl}`,
});
}
}
};

/**
* Creates a promise for linting a single file.
Expand Down Expand Up @@ -285,7 +285,7 @@ export default function gStylelintEsm(options) {
*/
throw createPluginError(error);
}
}
};

/**
* Handles each file in the stream, performs linting, and processes the results.
Expand Down Expand Up @@ -334,7 +334,7 @@ export default function gStylelintEsm(options) {

// Don't push the file back to the stream yet
done();
}
};

/**
* Handles the end of the stream, emitting errors if necessary.
Expand Down Expand Up @@ -391,7 +391,7 @@ export default function gStylelintEsm(options) {
*/
throw createPluginError(error);
}
}
};

/**
* Gulp transform stream for linting CSS files using stylelint.
Expand Down
2 changes: 1 addition & 1 deletion src/stylish-formatter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default function stylishFormatter(results, returnValue) {

output += '\n';
}
})
});

// Ensure consistent padding
output = output.trim();
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Plugin Functionality', () => {
})
);

expect(() => { stream }).not.toThrow();
expect(() => { stream; }).not.toThrow();
done();
});
it('should throw an error when configuration is NOT set', async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/stylish-formatter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('stylishFormatter', () => {
},
];

const returnValue = { ruleMetadata: {} }
const returnValue = { ruleMetadata: {} };

const output = stylishFormatter(results, returnValue);

Expand All @@ -39,7 +39,7 @@ describe('stylishFormatter', () => {
it('should outputs no valid files', () => {
const results = [];

const returnValue = { ruleMetadata: {} }
const returnValue = { ruleMetadata: {} };

const output = stylishFormatter(results, returnValue);

Expand Down
2 changes: 1 addition & 1 deletion test/writer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Writer Function', () => {
expect.assertions(1);

try {
await writeOutputLog(logFilePath, colors.blue('test content'))
await writeOutputLog(logFilePath, colors.blue('test content'));

expect((await fs.readFile(logFilePath)).toString()).toBe('test content');
} catch (e) {
Expand Down

0 comments on commit 0ac854e

Please sign in to comment.