Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

upgrade the eslint lib to v9#570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
ejahnGithub wants to merge5 commits intomainfromupdate/eslint-v9
Closed
Show file tree
Hide file tree
Changes fromall 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
32 changes: 32 additions & 0 deletions.github/workflows/eslint-version-compatibility.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
name: ESLint Compatibility Tests

on: [push, pull_request]

permissions:
contents: read

jobs:
eslint-test:
runs-on: ubuntu-latest

strategy:
matrix:
eslint-version: [8.0.1, 8, 9] # Test with ESLint v8 and v9

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '22'

- name: Install dependencies
run: npm ci

- name: Install Specific ESLint Version
run: npm install eslint@${{ matrix.eslint-version }} # Install ESLint based on matrix version

- name: Run Tests
run: npm run test
44 changes: 44 additions & 0 deletionseslint.config.mjs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
import {FlatCompat} from '@eslint/eslintrc'
import js from '@eslint/js'
import eslintPlugin from 'eslint-plugin-eslint-plugin'
import globals from 'globals'
import path from 'node:path'
import {fileURLToPath} from 'node:url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default [
...compat.extends('./lib/configs/recommended.js', 'plugin:eslint-plugin/all'),
{
plugins: {
'eslint-plugin': eslintPlugin,
},

languageOptions: {
globals: {
...globals.node,
},

ecmaVersion: 2022,
sourceType: 'module',
},

rules: {
'import/extensions': 'off',
'import/no-commonjs': 'off',
'filenames/match-regex': 'off',
'i18n-text/no-en': 'off',
'eslint-plugin/prefer-placeholders': 'off',
'eslint-plugin/test-case-shorthand-strings': 'off',
'eslint-plugin/require-meta-docs-url': 'off',
'prettier/prettier': 'off',
'no-unused-vars': 'off',
},
},
]
9 changes: 6 additions & 3 deletionslib/rules/async-currenttarget.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,12 +12,15 @@ module.exports = {
const scopeDidWait = new WeakSet()

return {
AwaitExpression() {
scopeDidWait.add(context.getScope(), true)
AwaitExpression(node) {
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)
scopeDidWait.add(scope, true)
},
MemberExpression(node) {
if (node.property && node.property.name === 'currentTarget') {
const scope = context.getScope()
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)
if (scope.block.async && scopeDidWait.has(scope)) {
context.report({node, message: 'event.currentTarget inside an async function is error prone'})
}
Expand Down
10 changes: 7 additions & 3 deletionslib/rules/async-preventdefault.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,12 +12,16 @@ module.exports = {
const scopeDidWait = new WeakSet()

return {
AwaitExpression() {
scopeDidWait.add(context.getScope(), true)
AwaitExpression(node) {
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)

scopeDidWait.add(scope, true)
},
CallExpression(node) {
if (node.callee.property && node.callee.property.name === 'preventDefault') {
const scope = context.getScope()
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)
if (scope.block.async && scopeDidWait.has(scope)) {
context.report({node, message: 'event.preventDefault() inside an async function is error prone'})
}
Expand Down
5 changes: 3 additions & 2 deletionslib/rules/no-implicit-buggy-globals.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,8 +10,9 @@ module.exports = {

create(context) {
return {
Program() {
const scope = context.getScope()
Program(node) {
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)

for (const variable of scope.variables) {
if (variable.writeable) {
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp