Open buffalojoec opened 4 months ago
That is wonderfull.
Hi @buffalojoec I can take care of this. Would take a look at migration guide and come back with updates. 😄
@andiz2 Thank you!!
Currently struggleing with the build..
Seems to be some dependency issues but I already updated rustc
beast@DESKTOP-TFSG0II:/mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library$ cargo build-sbf
error: package solana-program v1.18.2
cannot be built because it requires rustc 1.72.0 or newer, while the currently active rustc version is 1.68.0-dev
Either upgrade to rustc 1.72.0 or newer, or use
cargo update -p solana-program@1.18.2 --precise ver
where ver
is the latest version of solana-program
supporting rustc 1.68.0-dev
beast@DESKTOP-TFSG0II:/mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: checking for self-update
stable-x86_64-unknown-linux-gnu unchanged - rustc 1.77.2 (25ef9e3d8 2024-04-09) nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.79.0-nightly (1cec373f6 2024-04-16)
info: cleaning up downloads & tmp directories
beast@DESKTOP-TFSG0II:/mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library$ rustc --version
rustc 1.77.2 (25ef9e3d8 2024-04-09)
beast@DESKTOP-TFSG0II:/mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library$ cargo --version
cargo 1.77.2 (e52e36006 2024-03-26)
beast@DESKTOP-TFSG0II:/mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library$ cargo clean
Removed 0 files
beast@DESKTOP-TFSG0II:/mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library$ cargo build-sbf
error: package toml_edit v0.21.1
cannot be built because it requires rustc 1.69 or newer, while the currently active rustc version is 1.68.0-dev
Either upgrade to rustc 1.69 or newer, or use
cargo update -p toml_edit@0.21.1 --precise ver
where ver
is the latest version of toml_edit
supporting rustc 1.68.0-dev
beast@DESKTOP-TFSG0II:/mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library$ cargo update -p toml_edit --precise ver
error: invalid version format for precise version ver
Caused by:
unexpected character 'v' while parsing major version number
beast@DESKTOP-TFSG0II:/mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library$ cargo update -p toml_edit@newline' beast@DESKTOP-TFSG0II:/mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library$ cargo update -p toml_edit@<version> -bash: syntax error near unexpected token
newline'
beast@DESKTOP-TFSG0II:/mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library$ cargo update -p toml_edit@1.77
error: package ID specification toml_edit@1.77
did not match any packages
Did you mean `toml_edit`?
@andiz2 What caused this originally? You shouldn't need to mess with Cargo to work with JS, unless you're trying to run the e2e tests, which aren't really necessary for testing the linter. Ideally you just need to get pnpm lint
working.
In any case, your solana CLI version is out-of-date. cargo build-sbf
uses the Solana-forked rustc
compiler and whatever CLI version you're running has rustc 1.680-dev
. Try upgrading your CLI to 1.18
.
I will ignore Cargo and make pnpm lint work for the new version. If I'll have further Q I'll let you know.
I've used pnpm lint
with the current version and I've encountered some issues..
`@solana/spl-account-compression:lint: + eslint . --ext .js,.ts
@solana/spl-account-compression:lint:
@solana/spl-account-compression:lint: /mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library/account-compression/sdk/src/constants/index.ts
@solana/spl-account-compression:lint: 13:5 error Expected interface keys to be in ascending order. 'maxBufferSize' should be before 'maxDepth' typescript-sort-keys/interface
@solana/spl-account-compression:lint: 64:22 error Expected interface keys to be in ascending order. 'maxBufferSize' should be before 'maxDepth' typescript-sort-keys/interface
@solana/spl-account-compression:lint: 65:22 error Expected interface keys to be in ascending order. 'maxBufferSize' should be before 'maxDepth' typescript-sort-keys/interface
@solana/spl-account-compression:lint: 66:22 error Expected interface keys to be in ascending order. 'maxBufferSize' should be before 'maxDepth' typescript-sort-keys/interface
@solana/spl-account-compression:lint: 67:22 error Expected interface keys to
@solana/spl-account-compression:lint: /mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library/account-compression/sdk/src/generated/instructions/append.ts
@solana/spl-account-compression:lint: 47:5 error Expected interface keys to be in ascending order. 'authority' should be before 'merkleTree' typescript-sort-keys/interface
@solana/spl-account-compression:lint: 49:5 error Expected interface keys to be in ascending order. 'anchorRemainingAccounts' should be before 'noop' typescript-sort-keys/interface
@solana/spl-account-compression:lint:
@solana/spl-account-compression:lint: /mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library/account-compression/sdk/src/generated/instructions/closeEmptyTree.ts
@solana/spl-account-compression:lint: 31:5 error Expected interface keys to be in ascending order. 'authority' should be before 'merkleTree' typescript-sort-keys/interface
@solana/spl-account-compression:lint: 33:5 error Expected interface keys to be in ascending order. 'anchorRemainingAccounts' should be before 'recipient' typescript-sort-keys/interface
@solana/spl-account-compression:lint:
@solana/spl-account-compression:lint: /mnt/c/Users/admin/Documents/code js/spl-fork/solana-program-library/account-compression/sdk/src/generated/instructions/initEmptyMerkleTree.ts
@solana/spl-account-compression:lint: 18:5 error Expected interface keys to be in ascending order. 'maxBufferSize' should be before 'maxDepth' typescript-sort-keys/interface
@solana/spl-account-compression:lint: 49:5 error Expected interface keys to be in ascending order. 'authority' should be before 'merkleTree' `
Am I doing something wrong?
From what I've researched lately SPL have this ESLint config dependency: "@solana/eslint-config-solana": "^3.0.3",
and package.json of this config https://github.com/solana-labs/eslint-config-solana/blob/main/package.json
uses eslint 8.45.0..
...btw.. I am still curious why when I've ran pnpm lint on the actual code it brings lots of errors... https://github.com/solana-labs/solana-program-library/issues/6562#issuecomment-2067616527
I don't think spl-account-compression
has ever been passing lint. It looks like we skip it in CI.
https://github.com/solana-labs/solana-program-library/blob/18362b8f3ae9c634bd49eb78f8c200a825d3318c/ci/js-test-account-compression.sh#L12
I've added a PR to update this! https://github.com/solana-labs/solana-program-library/pull/6613
There's some more linting issues I noticed. For example, some packages (like name-service
) don't ignore the lib
directory when linting. I've also added a PR for this! https://github.com/solana-labs/solana-program-library/pull/6614
I took a crack at this today:
// ./libraries/type-length-value/js/eslint.config.cjs
const js = require('@eslint/js');
const PrettierPlugin = require('eslint-plugin-prettier');
const TypeScriptPlugin = require('@typescript-eslint/eslint-plugin');
const TypeScriptParser = require('@typescript-eslint/parser');
const RequireExtensionsPlugin = require('eslint-plugin-require-extensions');
/** @type {import('eslint').Linter.FlatConfig[]} */
module.exports = [
js.configs.recommended,
TypeScriptPlugin.configs.recommended,
PrettierPlugin.configs.recommended,
RequireExtensionsPlugin.configs.recommended,
{
ignores: ['docs', 'lib', 'test-ledger', 'package-lock.json'],
languageOptions: {
parser: TypeScriptParser,
},
plugins: {
'@typescript-eslint': TypeScriptPlugin,
prettier: PrettierPlugin,
'require-extensions': RequireExtensionsPlugin,
},
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
},
},
{
files: ['examples/**/*', 'test/**/*'],
rules: {
'require-extensions/require-extensions': 'off',
'require-extensions/require-index': 'off',
},
},
];
Until all of the plugins (@typescript-eslint
, Prettier, require-extensions-eslint-plugin
) are updated for ESLint 9, this project is dead in the water.
I mean, I guess we could just set ESLINT_USE_FLAT_CONFIG
to false
and punt it down the road, but we'd be toast once ESLint 10 comes around.
I mean, I guess we could just set
ESLINT_USE_FLAT_CONFIG
tofalse
and punt it down the road, but we'd be toast once ESLint 10 comes around.
Yeah I definitely didn't want to upgrade to 9 without using flat config.
I'll put this on hold until further news
Problem
The new ESLint 9.0 update is out, and Dependabot has tried upgrading SPL to it, but it has many breaking changes.
For example, ESLint 9 uses a new config file structure, as well as some different CLI flags and configuration keys.
https://eslint.org/docs/latest/use/migrate-to-9.0.0
Solution
Go through the migration guide and upgrade SPL to ES Lint 9.0!