Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

194 changes: 0 additions & 194 deletions .eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
.nyc_output
.idea
.vscode
coverage
node_modules
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.21
20.11.1
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ This is a monorepo.

## Development

Targeting Node.js version >=14.
Targeting Node.js version >=18.

Monorepo uses NPM v7 workspaces (make sure v7 is installed when used with Node.js v14.)
Monorepo uses NPM workspaces.
104 changes: 104 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import js from '@eslint/js';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import importPlugin from 'eslint-plugin-import';

const nodeGlobals = {
Buffer: 'readonly',
clearImmediate: 'readonly',
clearInterval: 'readonly',
clearTimeout: 'readonly',
console: 'readonly',
global: 'readonly',
process: 'readonly',
setImmediate: 'readonly',
setInterval: 'readonly',
setTimeout: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly',
};

const mochaGlobals = {
after: 'readonly',
afterEach: 'readonly',
before: 'readonly',
beforeEach: 'readonly',
describe: 'readonly',
it: 'readonly',
};

const tsFiles = ['**/*.{ts,mts,cts}'];
const jsFiles = ['**/*.{js,mjs,cjs}'];

export default [
{
ignores: [
'eslint.config.js',
'**/*{.,-}min.js',
'**/node_modules/**',
'**/coverage/**',
'**/lib/**',
'**/bin/**',
'**/types/**',
'.vscode/**',
'**/__*.*',
],
},
{
plugins: {
import: importPlugin,
},
languageOptions: {
ecmaVersion: 2020,
sourceType: 'module',
globals: nodeGlobals,
},
},
js.configs.recommended,
{
rules: {
'no-unused-vars': ['error', { args: 'none' }],

'import/no-unresolved': 'off',
'import/no-nodejs-modules': 'off',
'import/order': [
'error',
{ 'newlines-between': 'always', alphabetize: { order: 'asc', caseInsensitive: true } }
],
'import/newline-after-import': ['error', { 'count': 2 }],
'import/extensions': [
'error',
'ignorePackages',
{ 'cjs': 'always', 'js': 'never', 'json': 'always', 'mjs': 'always', 'ts': 'never' },
],
},
},
{
files: ['**/test/**/*.{js,ts,mjs,cjs,mts,cts}'],
languageOptions: { globals: mochaGlobals },
},
{
files: tsFiles,
plugins: { '@typescript-eslint': tsPlugin },
rules: {
...tsPlugin.configs.recommended.rules,
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
'no-unused-vars': 'off',
'import/extensions': 'off',
},
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
},
},
{
files: jsFiles,
rules: {
'no-unused-vars': ['error', { args: 'none' }],
},
},
];
6 changes: 2 additions & 4 deletions example/html-to-md.js → example/html-to-md.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { readFileSync } from 'fs';

import { htmlToMarkdown } from '../packages/html-to-md/src/html-to-md';
// const { htmlToMarkdown } = require('../packages/html-to-md/lib/html-to-md'); // build it first
import { htmlToMarkdown, type Options } from '../packages/html-to-md/lib/html-to-md.mjs';


console.log('From string:');
Expand All @@ -14,8 +13,7 @@ console.log();

console.log('From file:');
const filePath = new URL('test.html', import.meta.url);
/** @type { Options } */
const options = {
const options: Options = {
selectors: [
{ selector: 'table', format: 'block' },
{ selector: 'table#invoice', format: 'dataTable' },
Expand Down
6 changes: 2 additions & 4 deletions example/html-to-text.js → example/html-to-text.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { readFileSync } from 'fs';

import { htmlToText } from '../packages/html-to-text/src/html-to-text';
// const { htmlToText } = require('../packages/html-to-text/lib/html-to-text'); // build it first
import { htmlToText, type HtmlToTextOptions } from '../packages/html-to-text/lib/html-to-text.mjs';


console.log('From string:');
Expand All @@ -14,8 +13,7 @@ console.log();

console.log('From file:');
const filePath = new URL('test.html', import.meta.url);
/** @type { Options } */
const options = {
const options: HtmlToTextOptions = {
selectors: [
{ selector: 'table', format: 'block' },
{ selector: 'table#invoice', format: 'dataTable' },
Expand Down
Loading