-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Switch to ES modules. Keep CJS bundle in `dist` - Update dependencies - Apply `template-javascript` project configuration - Require Node.js version >= 14 - Update ESLint peer dependency to >=8.x - Update `ci` workflow to reference `master` branch
- Loading branch information
1 parent
13dc96a
commit 958d061
Showing
24 changed files
with
13,712 additions
and
5,052 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node 14.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
module.exports = { | ||
root: true, | ||
|
||
parser: '@babel/eslint-parser', | ||
parserOptions: { | ||
sourceType: 'module', | ||
}, | ||
|
||
ignorePatterns: [ | ||
'**/*.*', | ||
'!**/*.js', | ||
'tests/fixtures', | ||
'coverage', | ||
'node_modules', | ||
'dist', | ||
], | ||
env: { | ||
node: true, | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:jsdoc/recommended', | ||
'plugin:n/recommended', | ||
'plugin:unicorn/recommended', | ||
'prettier-standard/prettier-file', | ||
], | ||
settings: { | ||
jsdoc: { | ||
mode: 'typescript', | ||
}, | ||
}, | ||
// Keep rules grouped by plugin and sorted alphabetically | ||
rules: { | ||
'object-shorthand': ['error', 'always'], | ||
|
||
'padding-line-between-statements': [ | ||
'error', | ||
/* Empty line after import */ | ||
{ blankLine: 'always', prev: 'import', next: '*' }, | ||
{ blankLine: 'any', prev: 'import', next: 'import' }, | ||
/* Empty line before return */ | ||
{ blankLine: 'always', prev: '*', next: 'return' }, | ||
/* Empty line after const, let */ | ||
{ blankLine: 'always', prev: ['const', 'let'], next: '*' }, | ||
{ blankLine: 'any', prev: ['const', 'let'], next: ['const', 'let'] }, | ||
/* Empty line between case and default inside switch */ | ||
{ blankLine: 'always', prev: 'case', next: ['case', 'default'] }, | ||
], | ||
|
||
/* eslint-plugin-jsdoc */ | ||
|
||
// Descriptions should be sentence-like not comment-like | ||
'jsdoc/require-description-complete-sentence': 'warn', | ||
'jsdoc/require-hyphen-before-param-description': [ | ||
'error', | ||
'never', | ||
{ tags: { property: 'never' } }, | ||
], | ||
// Adding JSDoc is preferable but not required | ||
'jsdoc/require-jsdoc': 'off', | ||
'jsdoc/require-param-description': 'off', | ||
'jsdoc/require-property-description': 'off', | ||
'jsdoc/require-returns-description': 'off', | ||
'jsdoc/require-returns': 'off', | ||
|
||
'jsdoc/require-param-description': 'off', | ||
'jsdoc/require-returns-description': 'off', | ||
|
||
/* eslint-plugin-unicorn */ | ||
|
||
// I like reduce | ||
'unicorn/no-array-reduce': 'off', | ||
|
||
/* eslint-plugin-import */ | ||
|
||
// Require extension for imports. Required by Node.js with `type: "module"` | ||
'import/extensions': ['error', 'always', { ignorePackages: true }], | ||
// Force using only named exports | ||
'import/no-default-export': 'error', | ||
// Sort imports | ||
'import/order': [ | ||
'error', | ||
{ | ||
groups: [ | ||
'builtin', | ||
'external', | ||
'internal', | ||
'parent', | ||
'sibling', | ||
'type', | ||
], | ||
'newlines-between': 'always', | ||
alphabetize: { | ||
order: 'asc', | ||
caseInsensitive: false, | ||
}, | ||
}, | ||
], | ||
|
||
/* eslint-plugin-prettier */ | ||
|
||
'prettier/prettier': 'warn', | ||
|
||
/* eslint-plugin-n (node) */ | ||
|
||
'n/no-unsupported-features/es-syntax': [ | ||
'error', | ||
], | ||
}, | ||
|
||
overrides: [ | ||
// Test files | ||
{ | ||
files: 'tests/**/*', | ||
extends: ['plugin:ava/recommended'], | ||
}, | ||
// Config CommonJS files | ||
{ | ||
files: '*.cjs', | ||
rules: { | ||
/* eslint-plugin-unicorn */ | ||
|
||
'unicorn/prefer-module': 'off', | ||
}, | ||
}, | ||
], | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx --no-install commitlint --edit $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run test | ||
npx --no-install lint-staged |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"comments": false, | ||
"presets": [ | ||
[ | ||
"@babel/env", | ||
{ | ||
"modules": "cjs" | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { ESLint } from "eslint" | ||
import type { OutputPlugin } from "rollup" | ||
|
||
export type Options = { | ||
eslintOptions?: ESLint.Options; | ||
/** | ||
* If `true`, will throw an error if any warnings were found. | ||
*/ | ||
throwOnWarning?: boolean; | ||
/** | ||
* If `true`, will throw an error if any errors were found. | ||
*/ | ||
throwOnError?: boolean; | ||
/** | ||
* Formatter name or path to be passed to `eslint.loadFormatter()`. | ||
*/ | ||
formatter?: string; | ||
} | ||
|
||
/** | ||
* Runs ESLint on bundled code. | ||
*/ | ||
export function eslintBundle(options?: Options): OutputPlugin |
Oops, something went wrong.