diff --git a/.eslintrc.json b/.eslintrc.json index fa8852c..25b4aba 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,8 @@ { + "plugins": ["github"], "extends": [ "plugin:github/browser", - "plugin:github/es6", + "plugin:github/recommended", "plugin:github/typescript" ], "globals": { @@ -11,7 +12,10 @@ { "files": "test/**/*.js", "rules": { - "github/unescaped-html-literal": "off" + "github/no-inner-html": "off", + "github/unescaped-html-literal": "off", + "import/extensions": "off", + "import/no-unresolved": "off" } } ] diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 1cab6dc..6aed19c 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -3,7 +3,7 @@ name: Node CI on: pull_request: branches: - - master + - main jobs: build: runs-on: ${{ matrix.os }} @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Use Node.js 12.x + - name: Use Node.js 16.x uses: actions/setup-node@v1 with: - node-version: 12.x + node-version: 16.x - name: npm install, build, and test run: | npm install diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..5239060 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,24 @@ +name: Publish +on: + release: + types: [created] +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - name: Checkout the project + uses: actions/checkout@v3 + - name: Use Node.js 16.x (LTS) + uses: actions/setup-node@v3 + with: + node-version: 16.x + registry-url: https://registry.npmjs.org/ + cache: npm + - run: npm ci + - run: npm test + - run: npm version ${TAG_NAME} --git-tag-version=false + env: + TAG_NAME: ${{ github.event.release.tag_name }} + - run: npm whoami; npm publish --access public + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/README.md b/README.md index 3804e25..a9e8046 100644 --- a/README.md +++ b/README.md @@ -15,16 +15,22 @@ $ npm install @github/combobox-nav ```html ``` +Markup requirements: + +- Each option needs to have `role="option"` and a unique `id` +- The list should have `role="listbox"` + ### JS ```js @@ -54,15 +60,29 @@ A bubbling `combobox-commit` event is fired on the list element when an option i For example, autocomplete when an option is selected: ```js -list.addEventListener('combobox-commit', function(event) { +list.addEventListener('combobox-commit', function (event) { console.log('Element selected: ', event.target) }) ``` -**⚠ Note:** When using `