Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: github/eslint-plugin-github
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.10.2
Choose a base ref
...
head repository: github/eslint-plugin-github
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.0.0
Choose a head ref

Commits on Mar 4, 2024

  1. chore(deps): bump the all-dependencies group with 4 updates

    Bumps the all-dependencies group with 4 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser), [eslint-doc-generator](https://github.com/bmish/eslint-doc-generator) and [eslint-plugin-eslint-plugin](https://github.com/eslint-community/eslint-plugin-eslint-plugin).
    
    
    Updates `@typescript-eslint/eslint-plugin` from 7.0.2 to 7.1.0
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.1.0/packages/eslint-plugin)
    
    Updates `@typescript-eslint/parser` from 7.0.2 to 7.1.0
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.1.0/packages/parser)
    
    Updates `eslint-doc-generator` from 1.6.2 to 1.7.0
    - [Release notes](https://github.com/bmish/eslint-doc-generator/releases)
    - [Changelog](https://github.com/bmish/eslint-doc-generator/blob/main/CHANGELOG.md)
    - [Commits](bmish/eslint-doc-generator@v1.6.2...v1.7.0)
    
    Updates `eslint-plugin-eslint-plugin` from 5.3.0 to 5.4.0
    - [Release notes](https://github.com/eslint-community/eslint-plugin-eslint-plugin/releases)
    - [Changelog](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/main/CHANGELOG.md)
    - [Commits](eslint-community/eslint-plugin-eslint-plugin@v5.3.0...v5.4.0)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/eslint-plugin"
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: all-dependencies
    - dependency-name: "@typescript-eslint/parser"
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: all-dependencies
    - dependency-name: eslint-doc-generator
      dependency-type: direct:development
      update-type: version-update:semver-minor
      dependency-group: all-dependencies
    - dependency-name: eslint-plugin-eslint-plugin
      dependency-type: direct:development
      update-type: version-update:semver-minor
      dependency-group: all-dependencies
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 4, 2024
    Copy the full SHA
    40e84ca View commit details

Commits on Mar 8, 2024

  1. Merge pull request #510 from github/dependabot/npm_and_yarn/all-depen…

    …dencies-6293a276e4
    
    chore(deps): bump the all-dependencies group with 4 updates
    mattcosta7 authored Mar 8, 2024
    Copy the full SHA
    b4e9b8b View commit details

Commits on Mar 11, 2024

  1. chore(deps): bump the all-dependencies group with 2 updates

    Bumps the all-dependencies group with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).
    
    
    Updates `@typescript-eslint/eslint-plugin` from 7.1.0 to 7.1.1
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.1.1/packages/eslint-plugin)
    
    Updates `@typescript-eslint/parser` from 7.1.0 to 7.1.1
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.1.1/packages/parser)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/eslint-plugin"
      dependency-type: direct:production
      update-type: version-update:semver-patch
      dependency-group: all-dependencies
    - dependency-name: "@typescript-eslint/parser"
      dependency-type: direct:production
      update-type: version-update:semver-patch
      dependency-group: all-dependencies
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 11, 2024
    Copy the full SHA
    d0168b4 View commit details
  2. Merge pull request #511 from github/dependabot/npm_and_yarn/all-depen…

    …dencies-8c3f5b3775
    
    chore(deps): bump the all-dependencies group with 2 updates
    mattcosta7 authored Mar 11, 2024
    Copy the full SHA
    2a27ff1 View commit details

Commits on Mar 18, 2024

  1. chore(deps): bump the all-dependencies group with 2 updates

    Bumps the all-dependencies group with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).
    
    
    Updates `@typescript-eslint/eslint-plugin` from 7.1.1 to 7.2.0
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.2.0/packages/eslint-plugin)
    
    Updates `@typescript-eslint/parser` from 7.1.1 to 7.2.0
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.2.0/packages/parser)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/eslint-plugin"
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: all-dependencies
    - dependency-name: "@typescript-eslint/parser"
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: all-dependencies
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 18, 2024
    Copy the full SHA
    70aa44a View commit details
  2. Merge pull request #512 from github/dependabot/npm_and_yarn/all-depen…

    …dencies-759ba08314
    
    chore(deps): bump the all-dependencies group with 2 updates
    mattcosta7 authored Mar 18, 2024
    Copy the full SHA
    a6de768 View commit details

Commits on Mar 25, 2024

  1. chore(deps): bump the all-dependencies group with 3 updates

    Bumps the all-dependencies group with 3 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) and [eslint-plugin-eslint-plugin](https://github.com/eslint-community/eslint-plugin-eslint-plugin).
    
    
    Updates `@typescript-eslint/eslint-plugin` from 7.2.0 to 7.3.1
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.3.1/packages/eslint-plugin)
    
    Updates `@typescript-eslint/parser` from 7.2.0 to 7.3.1
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.3.1/packages/parser)
    
    Updates `eslint-plugin-eslint-plugin` from 5.4.0 to 5.4.1
    - [Release notes](https://github.com/eslint-community/eslint-plugin-eslint-plugin/releases)
    - [Changelog](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/main/CHANGELOG.md)
    - [Commits](eslint-community/eslint-plugin-eslint-plugin@v5.4.0...v5.4.1)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/eslint-plugin"
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: all-dependencies
    - dependency-name: "@typescript-eslint/parser"
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: all-dependencies
    - dependency-name: eslint-plugin-eslint-plugin
      dependency-type: direct:development
      update-type: version-update:semver-patch
      dependency-group: all-dependencies
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 25, 2024
    Copy the full SHA
    e17ea62 View commit details
  2. Merge pull request #514 from github/dependabot/npm_and_yarn/all-depen…

    …dencies-40cd00f236
    
    chore(deps): bump the all-dependencies group with 3 updates
    manuelpuyol authored Mar 25, 2024
    Copy the full SHA
    12b5f2d View commit details

Commits on May 3, 2024

  1. chore(deps): bump the all-dependencies group across 1 directory with …

    …4 updates
    
    Bumps the all-dependencies group with 4 updates in the / directory: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser), [eslint-plugin-eslint-plugin](https://github.com/eslint-community/eslint-plugin-eslint-plugin) and [mocha](https://github.com/mochajs/mocha).
    
    
    Updates `@typescript-eslint/eslint-plugin` from 7.3.1 to 7.8.0
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.8.0/packages/eslint-plugin)
    
    Updates `@typescript-eslint/parser` from 7.3.1 to 7.8.0
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.8.0/packages/parser)
    
    Updates `eslint-plugin-eslint-plugin` from 5.4.1 to 6.1.0
    - [Release notes](https://github.com/eslint-community/eslint-plugin-eslint-plugin/releases)
    - [Changelog](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/main/CHANGELOG.md)
    - [Commits](eslint-community/eslint-plugin-eslint-plugin@v5.4.1...v6.1.0)
    
    Updates `mocha` from 10.3.0 to 10.4.0
    - [Release notes](https://github.com/mochajs/mocha/releases)
    - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
    - [Commits](mochajs/mocha@v10.3.0...v10.4.0)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/eslint-plugin"
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: all-dependencies
    - dependency-name: "@typescript-eslint/parser"
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: all-dependencies
    - dependency-name: eslint-plugin-eslint-plugin
      dependency-type: direct:development
      update-type: version-update:semver-major
      dependency-group: all-dependencies
    - dependency-name: mocha
      dependency-type: direct:development
      update-type: version-update:semver-minor
      dependency-group: all-dependencies
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored May 3, 2024
    Copy the full SHA
    eb89ffd View commit details
  2. Merge pull request #522 from github/dependabot/npm_and_yarn/all-depen…

    …dencies-9541133021
    
    chore(deps): bump the all-dependencies group across 1 directory with 4 updates
    manuelpuyol authored May 3, 2024
    Copy the full SHA
    79ec251 View commit details

Commits on May 16, 2024

  1. Update tests and command

    khiga8 committed May 16, 2024
    Copy the full SHA
    ca7a3c3 View commit details
  2. Fix bug

    khiga8 committed May 16, 2024
    Copy the full SHA
    9deac20 View commit details
  3. Add .js extension so tests pass

    khiga8 committed May 16, 2024
    Copy the full SHA
    f7d1592 View commit details
  4. fix bugs

    khiga8 committed May 16, 2024
    Copy the full SHA
    9600041 View commit details
  5. update code comment

    khiga8 committed May 16, 2024
    Copy the full SHA
    e6f3c9e View commit details
  6. drop node 14

    khiga8 committed May 16, 2024
    Copy the full SHA
    d134206 View commit details
  7. drop ndoe 16

    khiga8 committed May 16, 2024
    Copy the full SHA
    dd592c6 View commit details
  8. add node 20 support

    khiga8 committed May 16, 2024
    Copy the full SHA
    9d2dc5d View commit details
  9. Update tests/utils/get-element-type.mjs

    khiga8 authored May 16, 2024
    Copy the full SHA
    3979a24 View commit details

Commits on May 20, 2024

  1. Merge pull request #525 from github/kh-fix-bug-in-get-element-type-logic

    Fix bug in `getElementType` logic
    khiga8 authored May 20, 2024
    Copy the full SHA
    ce529f9 View commit details
  2. Drop node 14 in publish workflow (#529)

    khiga8 authored May 20, 2024
    Copy the full SHA
    2b8550f View commit details
Showing with 338 additions and 323 deletions.
  1. +1 −0 .eslintrc.js
  2. +1 −1 .github/workflows/nodejs.yml
  3. +1 −1 .github/workflows/publish.yml
  4. +10 −3 lib/utils/get-element-type.js
  5. +307 −307 package-lock.json
  6. +2 −2 package.json
  7. +13 −6 tests/utils/get-element-type.mjs
  8. +2 −2 tests/utils/get-role.mjs
  9. +1 −1 tests/utils/object-map.mjs
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ module.exports = {
extends: [require.resolve('./lib/configs/recommended'), 'plugin:eslint-plugin/all'],
plugins: ['eslint-plugin'],
rules: {
'import/extensions': 'off',
'import/no-commonjs': 'off',
'filenames/match-regex': 'off',
'i18n-text/no-en': 'off',
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [14, 16, 18]
node-version: [18, 20]

steps:
- uses: actions/checkout@v4
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18
registry-url: https://registry.npmjs.org/
cache: npm
- run: npm ci
13 changes: 10 additions & 3 deletions lib/utils/get-element-type.js
Original file line number Diff line number Diff line change
@@ -16,15 +16,22 @@ function getElementType(context, node, lazyElementCheck = false) {

// check if the node contains a polymorphic prop
const polymorphicPropName = settings?.github?.polymorphicPropName ?? 'as'

const prop = getProp(node.attributes, polymorphicPropName)
const literalPropValue = getLiteralPropValue(getProp(node.attributes, polymorphicPropName))
let checkConditionalMap = true

// If the prop is not a literal and we cannot determine it, don't fall back to the conditional map value, if it exists
if (prop && !literalPropValue) {
checkConditionalMap = false
}
const rawElement = getLiteralPropValue(getProp(node.attributes, polymorphicPropName)) ?? elementType(node)

// if a component configuration does not exists, return the raw element
if (!settings?.github?.components?.[rawElement]) return rawElement

const defaultComponent = settings.github.components[rawElement]

// check if the default component is also defined in the configuration
return defaultComponent ? defaultComponent : defaultComponent
return checkConditionalMap ? settings.github.components[rawElement] : rawElement
}

module.exports = {getElementType}
614 changes: 307 additions & 307 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
"lint:eslint-docs": "npm run update:eslint-docs -- --check",
"lint:js": "eslint .",
"pretest": "mkdir -p node_modules/ && ln -fs $(pwd) node_modules/",
"test": "npm run eslint-check && npm run lint && mocha tests/**/*.js tests/",
"test": "npm run eslint-check && npm run lint && mocha tests/**/*.js tests/**/*.mjs",
"update:eslint-docs": "eslint-doc-generator"
},
"repository": {
@@ -61,7 +61,7 @@
"chai": "^5.0.0",
"eslint": "^8.0.1",
"eslint-doc-generator": "^1.4.3",
"eslint-plugin-eslint-plugin": "^5.0.0",
"eslint-plugin-eslint-plugin": "^6.1.0",
"mocha": "^10.0.0",
"npm-run-all": "^4.1.5"
}
19 changes: 13 additions & 6 deletions tests/utils/get-element-type.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import {expect} from 'chai'
import {getElementType} from '../../lib/utils/get-element-type'
import {mockJSXAttribute, mockJSXConditionalAttribute, mockJSXOpeningElement} from './mocks'

const mocha = require('mocha')
const describe = mocha.describe
const it = mocha.it
import {getElementType} from '../../lib/utils/get-element-type.js'
import {mockJSXAttribute, mockJSXConditionalAttribute, mockJSXOpeningElement} from './mocks.js'
import {describe, it} from 'mocha'

function mockSetting(componentSetting = {}) {
return {
@@ -63,4 +60,14 @@ describe('getElementType', function () {
])
expect(getElementType({}, node)).to.equal('Box')
})

it('returns raw type when polymorphic prop is set to non-literal expression even with component setting', function () {
const setting = mockSetting({
Box: 'div',
})
const node = mockJSXOpeningElement('Box', [
mockJSXConditionalAttribute('as', 'isNavigationOpen', 'generic', 'navigation'),
])
expect(getElementType(setting, node)).to.equal('Box')
})
})
4 changes: 2 additions & 2 deletions tests/utils/get-role.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {expect} from 'chai'
import {getRole} from '../../lib/utils/get-role'
import {mockJSXAttribute, mockJSXConditionalAttribute, mockJSXOpeningElement} from './mocks'
import {getRole} from '../../lib/utils/get-role.js'
import {mockJSXAttribute, mockJSXConditionalAttribute, mockJSXOpeningElement} from './mocks.js'
import {describe, it} from 'mocha'

describe('getRole', function () {
2 changes: 1 addition & 1 deletion tests/utils/object-map.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import {expect} from 'chai'
import ObjectMap from '../../lib/utils/object-map'
import ObjectMap from '../../lib/utils/object-map.js'
import {describe, it} from 'mocha'

describe('ObjectMap', function () {