From d9af680f3c81b62e710d4c9d364b7e70722ba28e Mon Sep 17 00:00:00 2001 From: Jason Slavin Date: Thu, 21 Dec 2023 07:53:13 -0800 Subject: [PATCH 1/2] Adding unist-util-select to dependencies, removing lint ignores, adding test workflow --- .github/workflows/run-tests.yaml | 40 ++++++++++++++++++++++ bacom-blog/aside/aside.js | 1 - bacom-blog/embed/embed.js | 1 - bacom-blog/figure/images-to-figure.js | 1 - bacom-blog/links/linksDnt.js | 1 - bacom-blog/pull-quote/pull-quote-update.js | 1 - bacom-blog/tag-header/tag-header.js | 1 - package.json | 1 + test/bacom-blog/aside/aside.test.js | 3 +- test/bacom-blog/quote/quote.test.js | 1 - test/utils/mdast-utils.test.js | 3 +- 11 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/run-tests.yaml diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml new file mode 100644 index 0000000..fc5ce8e --- /dev/null +++ b/.github/workflows/run-tests.yaml @@ -0,0 +1,40 @@ +name: Run tests +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened, edited] + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Install XVFB + run: sudo apt-get install xvfb + + - name: Install dependencies + run: npm install + + - name: Run the tests + run: xvfb-run -a npm test + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage/lcov.info diff --git a/bacom-blog/aside/aside.js b/bacom-blog/aside/aside.js index 53525dc..2dea2b2 100644 --- a/bacom-blog/aside/aside.js +++ b/bacom-blog/aside/aside.js @@ -1,5 +1,4 @@ import { readFile } from 'fs/promises'; -/* eslint-disable-next-line import/no-extraneous-dependencies */ import { select, selectAll } from 'unist-util-select'; import { getMdast, moveNodeParent } from '../../utils/mdast-utils.js'; import { STATUS_SUCCESS } from '../../utils/migration-utils.js'; diff --git a/bacom-blog/embed/embed.js b/bacom-blog/embed/embed.js index e45ebd0..235e750 100644 --- a/bacom-blog/embed/embed.js +++ b/bacom-blog/embed/embed.js @@ -1,4 +1,3 @@ -/* eslint-disable-next-line import/no-extraneous-dependencies */ import { select } from 'unist-util-select'; import { selectAllBlocks, extractLink } from '../../utils/mdast-utils.js'; import { diff --git a/bacom-blog/figure/images-to-figure.js b/bacom-blog/figure/images-to-figure.js index e001420..c3fc629 100644 --- a/bacom-blog/figure/images-to-figure.js +++ b/bacom-blog/figure/images-to-figure.js @@ -1,4 +1,3 @@ -/* eslint-disable-next-line import/no-extraneous-dependencies */ import { select } from 'unist-util-select'; import { selectAllBlocks } from '../../utils/mdast-utils.js'; import { STATUS_SUCCESS, STATUS_WARNING } from '../../utils/migration-utils.js'; diff --git a/bacom-blog/links/linksDnt.js b/bacom-blog/links/linksDnt.js index cc306a8..0712781 100644 --- a/bacom-blog/links/linksDnt.js +++ b/bacom-blog/links/linksDnt.js @@ -1,4 +1,3 @@ -/* eslint-disable-next-line import/no-extraneous-dependencies */ import { selectAll } from 'unist-util-select'; import { STATUS_SUCCESS, diff --git a/bacom-blog/pull-quote/pull-quote-update.js b/bacom-blog/pull-quote/pull-quote-update.js index f81a2eb..9693087 100644 --- a/bacom-blog/pull-quote/pull-quote-update.js +++ b/bacom-blog/pull-quote/pull-quote-update.js @@ -1,4 +1,3 @@ -/* eslint-disable-next-line import/no-extraneous-dependencies */ import { selectAll } from 'unist-util-select'; import { STATUS_SUCCESS, diff --git a/bacom-blog/tag-header/tag-header.js b/bacom-blog/tag-header/tag-header.js index cd93533..025a783 100644 --- a/bacom-blog/tag-header/tag-header.js +++ b/bacom-blog/tag-header/tag-header.js @@ -1,5 +1,4 @@ import { readFile } from 'fs/promises'; -/* eslint-disable-next-line import/no-extraneous-dependencies */ import { select, selectAll } from 'unist-util-select'; import { getMdast } from '../../utils/mdast-utils.js'; import { STATUS_SUCCESS, STATUS_WARNING } from '../../utils/migration-utils.js'; diff --git a/package.json b/package.json index 45e6ba9..1b34fcb 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "stylelint": "14.6.0", "stylelint-config-prettier": "9.0.3", "stylelint-config-standard": "25.0.0", + "unist-util-select": "^5.1.0", "xlsx": "^0.18.5" }, "lint-staged": { diff --git a/test/bacom-blog/aside/aside.test.js b/test/bacom-blog/aside/aside.test.js index f27e844..3be8dfa 100644 --- a/test/bacom-blog/aside/aside.test.js +++ b/test/bacom-blog/aside/aside.test.js @@ -1,6 +1,5 @@ import { readFile } from 'fs/promises'; import { expect } from '@esm-bundle/chai'; -/* eslint-disable-next-line import/no-extraneous-dependencies */ import { select } from 'unist-util-select'; import { getMdast, mdast2md } from '../../../utils/mdast-utils.js'; import { bannerToAside } from '../../../bacom-blog/aside/aside.js'; @@ -96,7 +95,7 @@ describe('convertBannerToAside', () => { expect(bannerMdast.type).to.equal('root'); const imageNode = select('image', bannerMdast); - expect(imageNode).to.be.null; + expect(imageNode).to.be.undefined; const mdast = await getMdast(mdast2md(bannerMdast)); expect(mdast).to.deep.equal(asideMdast); diff --git a/test/bacom-blog/quote/quote.test.js b/test/bacom-blog/quote/quote.test.js index edd217f..e2778b0 100644 --- a/test/bacom-blog/quote/quote.test.js +++ b/test/bacom-blog/quote/quote.test.js @@ -1,6 +1,5 @@ import { readFile } from 'fs/promises'; import { expect } from '@esm-bundle/chai'; -/* eslint-disable-next-line import/no-extraneous-dependencies */ import { select } from 'unist-util-select'; import { convertPullQuote, diff --git a/test/utils/mdast-utils.test.js b/test/utils/mdast-utils.test.js index a3371ee..85d9a55 100644 --- a/test/utils/mdast-utils.test.js +++ b/test/utils/mdast-utils.test.js @@ -1,5 +1,4 @@ import { expect } from '@esm-bundle/chai'; -/* eslint-disable-next-line import/no-extraneous-dependencies */ import { select } from 'unist-util-select'; import { getMdast, @@ -71,7 +70,7 @@ describe('mdast-utils', () => { moveNodeParent(fromMdast, 'image', 'paragraph', toMdast); expect(select('paragraph', toMdast)).to.not.be.null; - expect(select('paragraph', fromMdast)).to.be.null; + expect(select('paragraph', fromMdast)).to.be.undefined; }); }); }); From 54d1dcb2c0755a20d6001982db6a486c5be0352e Mon Sep 17 00:00:00 2001 From: Jason Slavin Date: Thu, 21 Dec 2023 07:58:38 -0800 Subject: [PATCH 2/2] Removing code compatability for browsers since repo is run in node alone at the moment --- .github/workflows/code-compatibility.yaml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .github/workflows/code-compatibility.yaml diff --git a/.github/workflows/code-compatibility.yaml b/.github/workflows/code-compatibility.yaml deleted file mode 100644 index 177164a..0000000 --- a/.github/workflows/code-compatibility.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Check code compatibility with Milo supported browsers - -on: - push: - branches: - - main - pull_request: - -jobs: - check: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Check for unsupported functions - run: | - # Install eslint and its plugins - npm install - - # Check for unsupported functions in the code - npx eslint --no-eslintrc -c .eslintrc-code-compatibility.js .