Skip to content

Commit

Permalink
ci: replace yml configs with js fp-53 (#72)
Browse files Browse the repository at this point in the history
* ci: replace yml lintstaged config with js fp-53

* ci: replace yml prettier config with js fp-53

* ci: replace yml eslint config with js fp-53
  • Loading branch information
what1s1ove authored Dec 5, 2023
1 parent c19f11b commit a632ded
Show file tree
Hide file tree
Showing 9 changed files with 616 additions and 367 deletions.
41 changes: 0 additions & 41 deletions .eslintrc.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .lintstagedrc.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .prettierrc.yml

This file was deleted.

2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { RuleConfigSeverity } from '@commitlint/types';
const PROJECT_PREFIXES = /** @type {const} */ ([`fp`, `release`]);

/** @type {import('@commitlint/types').UserConfig} */
let configuration = {
const configuration = {
extends: [`@commitlint/config-conventional`],
parserPreset: {
parserOpts: {
Expand Down
66 changes: 66 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import globals from 'globals';
// @ts-expect-error: no declaration file
import js from '@eslint/js';
// @ts-expect-error: no declaration file
import jsdoc from 'eslint-plugin-jsdoc';

/** @type {import('eslint').Linter.FlatConfig} */
const globalConfig = {
languageOptions: {
globals: globals.browser,
parserOptions: {
ecmaVersion: `latest`,
sourceType: `module`,
},
},
rules: {
...js.configs.recommended.rules,
},
};

/** @type {import('eslint').Linter.FlatConfig} */
const jsdocConfig = {
plugins: {
jsdoc,
},
rules: {
...jsdoc.configs[`recommended-typescript-flavor-error`].rules,
'jsdoc/require-jsdoc': [
`error`,
{
contexts: [
`ArrowFunctionExpression`,
`FunctionDeclaration`,
`FunctionExpression`,
],
},
],
'jsdoc/require-param-description': [`off`],
'jsdoc/require-returns-description': [`off`],
'jsdoc/valid-types': [`off`],
},
settings: {
jsdoc: {
mode: `typescript`,
},
},
};

/** @type {import('eslint').Linter.FlatConfig} */
const mainRulesConfig = {
rules: {
'no-multiple-empty-lines': [
'error',
{
max: 1,
},
],
curly: ['error', 'all'],
'arrow-parens': ['error', 'always'],
},
};

/** @type {import('eslint').Linter.FlatConfig[]} */
const config = [globalConfig, jsdocConfig, mainRulesConfig];

export default config;
8 changes: 8 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('lint-staged').Config} */
const config = {
'*': ['npm run lint:fs', 'npm run lint:editor'],
'*.{json,md,yml,js}': 'prettier --write',
'*.js': ['npm run lint:js', "bash -c 'npm run lint:type'"],
};

export default config;
Loading

0 comments on commit a632ded

Please sign in to comment.