diff --git a/.eslintrc.js b/.eslintrc.js index 81e50c9..f45f1c5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -28,6 +28,7 @@ module.exports = { }, extends: [ 'eslint:recommended', + 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-requiring-type-checking', 'standard-with-typescript', @@ -36,63 +37,52 @@ module.exports = { ], rules: { 'comma-dangle': ['error', 'always-multiline'], + // Disable in favour of TypeScript rule. + 'func-call-spacing': 'off', 'linebreak-style': ['error', 'unix'], - // Changed from error to warn and enabled ignoreEOLComments. + 'lines-between-class-members': 'off', + // Disable in favour of TypeScript rule. + 'no-extra-semi': 'off', 'no-multi-spaces': ['warn', { ignoreEOLComments: true, }], - // Changed from error to warn and adjusted options. 'no-multiple-empty-lines': ['warn', { max: 2, maxEOF: 1, maxBOF: 1, }], 'no-template-curly-in-string': 'off', - // Changed from 'after' to 'before'. 'operator-linebreak': ['error', 'before'], - // Changed from error and all 'never' to warn and switches 'never'. 'padded-blocks': ['warn', { switches: 'never', }], - // Changed from 'as-needed' to 'consistent-as-needed'. 'quote-props': ['error', 'consistent-as-needed'], + // Disable in favour of TypeScript rule. + 'semi': 'off', // Import - - // Some packages have wrong type declarations. 'import/default': 'off', 'import/newline-after-import': 'warn', + 'import/no-absolute-path': 'error', // This rule disallows using both wildcard and selective imports from the same module. 'import/no-duplicates': 'off', - // Some packages have it wrong in type declarations (e.g. katex, marked). + // Some packages has it wrong in type declarations (e.g. katex, marked). 'import/no-named-as-default-member': 'off', + 'import/order': ['warn', { + 'groups': [['builtin', 'external']], + 'newlines-between': 'always-and-inside-groups', + }], // TypeScript - - // Changed options. - '@typescript-eslint/ban-types': ['error', { - // Allow to use {} and object - they are actually useful. - types: { - '{}': false, - 'object': false, - }, - extendDefaults: true, - }], - '@typescript-eslint/class-literal-property-style': ['error', 'fields'], - // Changed from error to off. '@typescript-eslint/consistent-type-definitions': 'off', - // Changed from error to off. '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/explicit-member-accessibility': ['error', { + '@typescript-eslint/explicit-member-accessibility': ['warn', { accessibility: 'no-public', overrides: { parameterProperties: 'off', }, }], - // Changed from warn to error and adjusted options. - '@typescript-eslint/explicit-module-boundary-types': ['error', { - allowArgumentsExplicitlyTypedAsAny: true, - }], + '@typescript-eslint/func-call-spacing': ['error', 'never'], '@typescript-eslint/indent': ['error', 2, { SwitchCase: 1, VariableDeclarator: 1, @@ -111,55 +101,34 @@ module.exports = { flatTernaryExpressions: true, ignoreComments: false, }], - // Changed from error to warn. - '@typescript-eslint/lines-between-class-members': 'warn', - // Changed delimiter for type literals from none to comma. - // The reason is just aesthetic symmetry with object literals. '@typescript-eslint/member-delimiter-style': ['error', { multiline: { delimiter: 'comma', requireLast: true }, singleline: { delimiter: 'comma', requireLast: false }, - overrides: { - interface: { - multiline: { delimiter: 'none' }, - }, - }, }], - '@typescript-eslint/member-ordering': 'warn', - // Changed from warn to off. '@typescript-eslint/no-explicit-any': 'off', - // Changed from error to warn. - '@typescript-eslint/no-extra-semi': 'warn', - // It disallows using void even in valid cases. - '@typescript-eslint/no-invalid-void-type': 'off', - // Changed from error to warn. '@typescript-eslint/no-namespace': 'warn', - // Changed from error to warn. '@typescript-eslint/no-non-null-assertion': 'warn', '@typescript-eslint/no-require-imports': 'error', - // Changed from error to warn. - '@typescript-eslint/no-unsafe-assignment': 'warn', - // Changed from error to warn. - '@typescript-eslint/no-unsafe-member-access': 'warn', // Disabled in favour of the next rule. '@typescript-eslint/no-unused-vars': 'off', '@typescript-eslint/no-unused-vars-experimental': 'error', - // Changed options. '@typescript-eslint/no-use-before-define': ['error', { + classes: true, functions: false, typedefs: false, + variables: true, }], '@typescript-eslint/prefer-for-of': 'warn', - // Changed from error to warn. '@typescript-eslint/prefer-includes': 'warn', - // Changed from error to warn. '@typescript-eslint/prefer-regexp-exec': 'warn', '@typescript-eslint/prefer-string-starts-ends-with': 'warn', + '@typescript-eslint/promise-function-async': ['error', { + allowAny: true, + }], // It has too many false positives. '@typescript-eslint/restrict-template-expressions': 'off', - // Changed from error to off. + '@typescript-eslint/semi': ['error', 'never'], '@typescript-eslint/strict-boolean-expressions': 'off', - '@typescript-eslint/switch-exhaustiveness-check': 'error', - // Changed from error to warn and adjusted options. '@typescript-eslint/unbound-method': ['warn', { ignoreStatic: true, }], @@ -175,9 +144,9 @@ module.exports = { objects: 'always-multiline', imports: 'always-multiline', exports: 'always-multiline', - // Changed to not require comma in a multiline expect(). functions: 'only-multiline', }], + 'comma-spacing': 'off', 'object-curly-spacing': 'off', 'no-multi-spaces': 'off', 'standard/array-bracket-even-spacing': 'off', @@ -185,10 +154,6 @@ module.exports = { 'space-in-parens': 'off', // jest.mock() must be above imports. 'import/first': 'off', - '@typescript-eslint/comma-spacing': 'off', - // False positive on expect() functions. - '@typescript-eslint/no-unsafe-call': 'off', - '@typescript-eslint/no-unsafe-return': 'warn', }, }, ], diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index f191d60..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ -# These are supported funding model platforms - -github: jirutka diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 6407fe6..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: CI -on: - - push - - pull_request - -jobs: - test: - name: Test on Node.js ${{ matrix.node-version }} - runs-on: ubuntu-20.04 - strategy: - matrix: - node-version: [10, 12, 13, 14] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # fetch all history to make `git describe` work - - - name: Setup Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - - run: yarn install - - run: yarn build - - run: yarn bundle - - run: yarn test - - run: yarn lint - - publish: - name: Publish to npmjs and GitHub Releases - needs: [test] - if: startsWith(github.ref, 'refs/tags/v') - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # fetch all history to make `git describe` work - - - run: sudo apt-get install asciidoctor pandoc - - - uses: actions/setup-node@v2 - with: - node-version: 14 - registry-url: https://registry.npmjs.org - - - run: yarn install - - - name: Generate source tarball - run: ./scripts/create-src-tarball dist/ipynb2html-${GITHUB_REF/refs\/tags\//}-src.tar.gz - - - run: yarn build - - run: yarn bundle - - - name: Publish packages to npmjs - run: yarn publish-all --non-interactive - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Upload tarballs to Releases - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - fail_on_unmatched_files: true - files: | - dist/*.tar.gz - packages/ipynb2html-cli/dist/*.tar.gz - packages/ipynb2html-cli/dist/*.zip diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..93fcf20 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,56 @@ +dist: bionic + +language: node_js +node_js: + - '13' + - '12' + - '10' + - lts/* + - node + +addons: + apt: + packages: + - asciidoctor + - pandoc + +env: + global: + - secure: "DrPA1eYBRjS+1/w/sRq/r5wQyOewuh1PGPzFtQR62TJeAyO6AvKQ6wfesxMA898b+0D3SCNxrCVK12XB3auySEOZocQuN7N51hsteA/QtPoBBbnoHy8Dap2YbiJ5fbCVnM/Wl/Z2rZmQWFBM3rmqXggCyEhKEw3kkz8WMm/7UCGVxmoHUelpMnDEII0RiJdPCGT19IA90KpJDsqbSzTVY+TsqjSNuN91LQ23ApwSHKklvbvKWxcgrtAzJDXLeS9CS3QqSHucurOM2Kpv0umOkBzds4da+NtWKYZC3XxThmMB5wT7b60EZPIc/iFftQFy2qiDAFxeGN+j9kwsNX68aXl4MuCGlzdvGj0KkeXYYhl1Jusc30uTzXYMlz2b3u+AcsMLLxFs2HvUU94SpAfe9VrarSnQK+6CZz0eCtF/NCCi6J9GqlBTsqzZDmdVaJpFDG1FidC4Ka9FcteKcWXqffowQ5KjIhqaearSmRESMqepV7T8tDUCb217PE0C+L0NGfg6RaY4DtGsJAawDeh/09aXrP6NakAKjWUfaJqjhkMexB8JTb+yanjVXsgj4VUfvTgvWjMi+yU3DIfopL+mawvgckRRL9DTEIf5ICjSruyEH8FWEz+kMzas41zboabR12YMLuorHfgZu31DiDsJkSD292t/lwWW6oybRl0iJBk=" # NPM_TOKEN=ceed......2bf2 + +cache: yarn + +install: + - yarn install + - test -z "$TRAVIS_TAG" || ./scripts/create-src-tarball dist/ipynb2html-$TRAVIS_TAG-src.tar.gz + +script: + - yarn run build + - yarn run bundle + - yarn run test + - yarn run lint + +before_deploy: + - echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> "$HOME"/.npmrc + +deploy: + - provider: script + script: yarn publish-all --non-interactive + skip_cleanup: true + on: + repo: jirutka/ipynb2html + tags: true + node_js: '10' + - provider: releases + api_key: + secure: j5Ks+lUUE2NkUKKC4A+FRKVia3oRyanMKp25jZwF2jLOQxZp0/BggNOduw7zMLzPizmMbz7CkYV/pLyXH+rwCjOdQPnSGLorzfp6ztzG49SqPUK5i5PdSctYT7+C2HdYR25xtw6f06HXzLWTIeYb0JG+5pUCkI4R+z1JEqZhx3PMOkAx9Ec9UoYNKcbHe1E78y8zH0pDccVJ1ejrbmizEqZALpYNR+qCWhTfLVbwYlpJJGIKCIXVYI9tU/3y/6JOO+gCX2m8jqNVBPrwWWD//gGExn2lR6BK0WiXTE71FbM7GyVjoeh93Zg1WifF+7DBtaTI9qs+928afLn28AcWqB6P/HgoRgt/4oLvJU2hkdkIoNqQONqYZeglW1A5qYp6T3nURLpcn1cg2yBD6vNi8cet4ntgOsPu9Soa8pzsm9xcITMJNUlFOEWyYPyvgTXHUjZwbZvrZHRVYeHrDOuq9EEAz+11u1FYG49uSBZf3+H6CmL7n2qeoYhlMhT94bgIkF4ByFmP+OTUcMcWvDdA7uD8JqPMaxQI0hhjrszxPT7C5YNXsJ1Q0vU2zZSMF74fygsXlnr6VeqwxSzgF/6mAAuSwtKSg/pFPPLdevIeehw4oLCz+ZdxVk5kpfymKvqvueDdMMoV4Fse4Yhv81Z76tAPM35TtqJa77DJwqOVOCE= + file_glob: true + file: + - dist/*.tar.gz + - packages/ipynb2html-cli/dist/*.tar.gz + - packages/ipynb2html-cli/dist/*.zip + skip_cleanup: true + on: + repo: jirutka/ipynb2html + tags: true + node_js: '10' diff --git a/README.adoc b/README.adoc index dd607d9..f731df7 100644 --- a/README.adoc +++ b/README.adoc @@ -2,15 +2,15 @@ :npm-name: ipynb2html :gh-name: jirutka/{npm-name} :gh-branch: master -:version: 0.3.0 -:ansiup-version: 5.0.1 -:hljs-version: 10.7.3 -:katex-version: 0.13.11 -:marked-version: 2.0.7 +:version: 0.2.1 +:ansiup-version: 4.0.4 +:hljs-version: 9.15.10 +:katex-version: 0.11.1 +:marked-version: 0.7.0 :vs-marketplace-uri: https://marketplace.visualstudio.com/items?itemName= ifdef::env-github[] -image:https://github.com/{gh-name}/workflows/CI/badge.svg[CI Status, link=https://github.com/{gh-name}/actions?query=workflow%3A%22CI%22] +image:https://travis-ci.com/{gh-name}.svg?branch={gh-branch}[Build Status, link="https://travis-ci.com/{gh-name}"] endif::env-github[] {npm-name} is a converter (renderer) of the https://nbformat.readthedocs.io/en/stable/[Jupyter Notebook Format] 4.0+ to static HTML. diff --git a/examples/bundle-full.html b/examples/bundle-full.html index 30de9f0..0778c40 100644 --- a/examples/bundle-full.html +++ b/examples/bundle-full.html @@ -7,11 +7,11 @@