Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions .changeset/lovely-hats-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@naverpay/eslint-config": patch
"@naverpay/eslint-plugin": patch
---

๐Ÿ”ง Remove deprecated ESLint APIs and duplicate plugin registration

PR: [๐Ÿ”ง Remove deprecated ESLint APIs and duplicate plugin registration](https://github.com/NaverPayDev/code-style/pull/152)
5 changes: 0 additions & 5 deletions packages/eslint-config/node/rules/style.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import nodePlugin from 'eslint-plugin-n'

export default {
plugins: {
n: nodePlugin,
},
rules: {
/**
* Require the use of === and !==
Expand Down
5 changes: 0 additions & 5 deletions packages/eslint-config/react/rules/node.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import nodePlugin from 'eslint-plugin-n'

export default {
plugins: {
n: nodePlugin,
},
rules: {
/**
* When a function is named cb or callback, then it must be invoked with a first argument that is undefined, null, an Error class, or a subclass or Error
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin/lib/rules/import-server-only.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
},
create(context) {
const {include, exclude} = context.options[0] || {}
const filePath = path.relative(context.getCwd(), context.getFilename())
const filePath = path.relative(context.cwd, context.filename)

const isIncluded = micromatch.isMatch(filePath, include)
const isExcluded = micromatch.isMatch(filePath, exclude)
Expand All @@ -46,7 +46,7 @@ export default {
(statement) => statement.type === 'ImportDeclaration' && statement.source.value === 'server-only',
)

const sourceCode = context.sourceCode ?? context.getSourceCode()
const sourceCode = context.sourceCode

if (!hasServerOnlyImport) {
context.report({
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin/lib/rules/memo-react-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {

let isAlreadyMemoized = false

const sourceCode = context.sourceCode ?? context.getSourceCode()
const sourceCode = context.sourceCode

/**
* @type {import('eslint').Scope.Scope | undefined}
Expand All @@ -48,7 +48,7 @@ export default {

const reactImportDeclaration = importDeclarations.find(({source: {value}}) => value === 'react')

let isDefault = false
let isDefault
let hasImportMemo = false
let isDefaultOnly = false
if (reactImportDeclaration) {
Expand Down Expand Up @@ -88,7 +88,7 @@ export default {

return {
Program: function (node) {
globalScope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope()
globalScope = sourceCode.getScope(node)

const exportDefaultDeclaration = getExportDefaultDeclaration(globalScope.block).declaration
if (
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin/lib/rules/optimize-svg-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default {
return {}
}

const sourceCode = context.sourceCode ?? context.getSourceCode()
const sourceCode = context.sourceCode

/**
* @type {import('eslint').Scope.Scope | undefined}
Expand All @@ -149,7 +149,7 @@ export default {

return {
Program: function (node) {
globalScope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope()
globalScope = sourceCode.getScope(node)
canOptimize = svgValidator(context, globalScope)
},
onCodePathEnd: function (_, code) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
return
}

const sourceCode = context.sourceCode ?? context.getSourceCode()
const sourceCode = context.sourceCode
let json

try {
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin/lib/rules/sort-exports.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {minimatch} from 'minimatch'

function getCommentFromNode(context, node) {
const beforeComments = context.getSourceCode().getCommentsBefore(node)
const afterComments = context.getSourceCode().getCommentsAfter(node)
const beforeComments = context.sourceCode.getCommentsBefore(node)
const afterComments = context.sourceCode.getCommentsAfter(node)
const result = {}

const nodeStartLine = node.loc.start.line
Expand Down Expand Up @@ -53,7 +53,7 @@ function getIdentifier(node) {
exportKind,
} = node

let wholeLine = ''
let wholeLine

if (specifiers.length === 1) {
if (specifiers[0].local.name === 'default') {
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin/lib/rules/svg-unique-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ export default {
* @type {import('eslint').Scope.Scope | undefined}
*/
let globalScope
const sourceCode = context.sourceCode ?? context.getSourceCode()
const sourceCode = context.sourceCode

return {
Program: function (node) {
globalScope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope()
globalScope = sourceCode.getScope(node)
},
onCodePathEnd: function (_, code) {
const svgElement = getJSXReturnStatement(globalScope)
Expand Down