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
208 changes: 189 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/eslint-config/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## 3.0.0
- Upgrades `eslint-plugin-tsdoc` dependency from 0.4.0 to 0.5.0.
- Upgrades the dependency `eslint-plugin-array-func` from 4.0.0 to 5.1.0. Due to this upgrade, the `eslint-config` had to be converted from CommonJS to an ESM compatible implementation. This is because the said dependency only works with ESM modules.
- Note: There is no behavioral change in the linter rules enforced by this package.

## 2.0.0
- Migrated ESLint, and it's related plugins to their latest major version. [Breaking Change]
- @xrplf/eslint-config version 2.0.0 now exports Flat configs that are equivalent to ^1.0.0 in terms of configuration rules barring some breaking changes there were introduced by ESLint itself, and other ESLint plugins that this shared config exported. See [V2_MIGRATION.md](./V2_MIGRATION.md). [Breaking Change]

Expand Down
34 changes: 17 additions & 17 deletions packages/eslint-config/base.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
const eslint = require('@eslint/js')
const globals = require('globals')
import eslint from '@eslint/js'
import globals from 'globals'

const typescriptEslint = require('./rules/@typescript-eslint')
const arrayFunc = require('./rules/array-func')
const comments = require('./rules/eslint-comments')
const bestPractices = require('./rules/eslint-core/best-practices')
const errors = require('./rules/eslint-core/errors')
const es6 = require('./rules/eslint-core/es6')
const strict = require('./rules/eslint-core/strict')
const style = require('./rules/eslint-core/style')
const variables = require('./rules/eslint-core/variables')
const importRules = require('./rules/import')
const jsdoc = require('./rules/jsdoc')
const node = require('./rules/node')
const prettier = require('./rules/prettier')
const tsdoc = require('./rules/tsdoc')
import typescriptEslint from './rules/@typescript-eslint.js'
import arrayFunc from './rules/array-func.js'
import comments from './rules/eslint-comments.js'
import bestPractices from './rules/eslint-core/best-practices.js'
import errors from './rules/eslint-core/errors.js'
import es6 from './rules/eslint-core/es6.js'
import strict from './rules/eslint-core/strict.js'
import style from './rules/eslint-core/style.js'
import variables from './rules/eslint-core/variables.js'
import importRules from './rules/import.js'
import jsdoc from './rules/jsdoc.js'
import node from './rules/node.js'
import prettier from './rules/prettier.js'
import tsdoc from './rules/tsdoc.js'

module.exports = [
export default [
eslint.configs.recommended,
...errors,
...bestPractices,
Expand Down
15 changes: 12 additions & 3 deletions packages/eslint-config/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const baseConfig = require('./base')
import baseConfig from './base.js'

module.exports = [
export default [
...baseConfig,
{
languageOptions: {
Expand All @@ -19,14 +19,23 @@ module.exports = [
'import/unambiguous': 'off',
'import/no-commonjs': 'off',
'import/no-unused-modules': 'off',
},
},
// Overrides for this package only
{
files: ['*.js', 'rules/**/*.js'],
rules: {
// ESM requires .js extensions for relative imports
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
js: 'always',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since, this is a behaviour change, I would suggest that we import the package from this PR locally into xrpl.js to make sure that linting passes or evaluate how much work needs to be done to fix linting errors that occurs after this change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have ensured that this behavioral change only affects the files located inside this specific package. No downstream users of this package are affected by this change due to the regex used in the files section of eslint config file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in 75bab6b

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see it's only suppressed for this repo.

No downstream users of this package are affected by this change due to the regex used in the files section of eslint config file.

The regex applies only for this repo. Did we try importing the package from this branch into xrpl.js to check if it works fine?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I will do that in some time and get back to you. I wasn't sure how to import an unpublished package (this new version of typescript-style repo) into xrpl.js

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When importing a package locally, I would first delete node_modules and package-lock.json and install it fresh.

We can import it something like this:

 "@xrplf/eslint-config": "file:<PACKAGE_PATH>"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the PR that uses the new versions of dependencies: XRPLF/xrpl.js#3187

The linter passes for this PR (on my local computer, it might not clear the CI) and all the unit tests pass.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! I guess package-lock.json in this PR is outdated based on package version. Should regenerate it.

mjs: 'always',
},
],
// Allow anonymous default exports in ESLint config files
'import/no-anonymous-default-export': 'off',
},
},
]
6 changes: 3 additions & 3 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const base = require('./base')
const react = require('./rules/react')
import base from './base.js'
import react from './rules/react.js'

module.exports = [...react, ...base]
export default [...react, ...base]
6 changes: 3 additions & 3 deletions packages/eslint-config/loose-base.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const base = require('./base')
const common = require('./rules/common')
import base from './base.js'
import common from './rules/common.js'

module.exports = [
export default [
...base,
{
rules: {
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-config/loose.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const looseBase = require('./loose-base')
const react = require('./rules/react')
import looseBase from './loose-base.js'
import react from './rules/react.js'

module.exports = [...react, ...looseBase]
export default [...react, ...looseBase]
Loading