Skip to content

Commit

Permalink
feat: add back mocha rules
Browse files Browse the repository at this point in the history
  • Loading branch information
voxpelli committed May 26, 2024
1 parent d0393bb commit fb7ce84
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 5 deletions.
20 changes: 20 additions & 0 deletions base-configs/mocha.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// @ts-ignore
import mochaPlugin from 'eslint-plugin-mocha';
import globals from 'globals';
import { config } from 'typescript-eslint';

export const mochaRules = config({
ignores: ['**/*', '!test/**/*'],
'extends': [
mochaPlugin.configs.flat.recommended,
],
languageOptions: {
globals: {
...globals.mocha,
},
},
rules: {
'mocha/no-mocha-arrows': 'off',
'no-unused-expressions': 'off',
},
});
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ import neostandard from 'neostandard';
import { additionalRules } from './base-configs/additional-rules.js';
import { esmRules } from './base-configs/esm.js';
import { jsdocRules } from './base-configs/jsdoc.js';
import { mochaRules } from './base-configs/mocha.js';

/**
* @param {{ cjs?: boolean }} [options]
* @param {{ cjs?: boolean, noMocha?: boolean }} [options]
* @returns {import('@typescript-eslint/utils/ts-eslint').FlatConfig.ConfigArray}
*/
export function voxpelli ({ cjs } = {}) {
export function voxpelli ({ cjs, noMocha } = {}) {
return [
...neostandard({ semi: true }),
...additionalRules,
...jsdocRules,
...cjs ? [] : esmRules,
...noMocha ? [] : mochaRules,
];
}

Expand Down
76 changes: 75 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"build:1-declaration": "tsc -p declaration.tsconfig.json",
"build:2-add-ignores": "ts-ignore-import '**/*.d.ts'",
"build": "run-s build:*",
"check:installed-check": "installed-check -i @typescript-eslint/utils",
"check:installed-check": "installed-check -i @typescript-eslint/utils -i typescript-eslint",
"check:knip": "knip",
"check:lint": "eslint --report-unused-disable-directives .",
"check:type-coverage": "type-coverage --detail --strict --at-least 67 --ignore-files 'test/*'",
Expand Down Expand Up @@ -65,9 +65,12 @@
"dependencies": {
"eslint-plugin-es-x": "^7.6.0",
"eslint-plugin-jsdoc": "^48.2.6",
"eslint-plugin-mocha": "^10.4.3",
"eslint-plugin-n": "^17.7.0",
"eslint-plugin-sort-destructure-keys": "^1.6.0",
"eslint-plugin-unicorn": "^53.0.0",
"neostandard": "^0.4.0"
"globals": "^15.3.0",
"neostandard": "^0.4.0",
"typescript-eslint": "^7.10.0"
}
}

0 comments on commit fb7ce84

Please sign in to comment.