Skip to content
Open
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
58,201 changes: 32,003 additions & 26,198 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions packages/scratch-gui/.eslintignore

This file was deleted.

4 changes: 0 additions & 4 deletions packages/scratch-gui/.eslintrc.js

This file was deleted.

137 changes: 137 additions & 0 deletions packages/scratch-gui/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import {eslintConfigScratch} from 'eslint-config-scratch';
import {globalIgnores} from 'eslint/config';
import globals from 'globals';
import importPlugin from 'eslint-plugin-import';
import path from 'path';

export default eslintConfigScratch.defineConfig(
eslintConfigScratch.legacy.base,
importPlugin.flatConfigs.errors,
{
files: ['*.{js,cjs,mjs,ts}', 'scripts/**/*.{js,cjs,mjs,ts}'],
extends: [eslintConfigScratch.legacy.node],
languageOptions: {
globals: globals.node
},
rules: {
'no-console': 'off'
},
settings: {
// TODO: figure out why this is needed...
// probably something with eslint-plugin-import's parser or resolver
'import/core-modules': [
'eslint/config'
]
}
},
{
files: ['{src,test}/**/*.{js,cjs,mjs,jsx,ts,tsx}'],
extends: [
eslintConfigScratch.legacy.es6,
eslintConfigScratch.legacy.react,
eslintConfigScratch.legacy.typescript
],
languageOptions: {
globals: {
...globals.browser,
process: 'readonly'
},
parserOptions: {
projectService: false,
tsconfigRootDir: import.meta.dirname,
project: [
'tsconfig.json',
'tsconfig.test.json'
]
}
},
settings: {
'react': {
version: 'detect'
},
'import/resolver': {
webpack: {
config: path.resolve(import.meta.dirname, 'webpack.config.js')
}
}
},
rules: {
// BEGIN: these caused trouble after upgrading eslint-plugin-react from 7.24.0 to 7.33.2
'react/forbid-prop-types': 'warn',
'react/no-unknown-property': 'warn',
// END: these caused trouble after upgrading eslint-plugin-react from 7.24.0 to 7.33.2

// we should probably just fix these...
'arrow-parens': 'warn',
'react/no-deprecated': 'warn',
'require-atomic-updates': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', {
args: 'after-used',
caughtErrors: 'none', // TODO: use caughtErrorsPattern instead
varsIgnorePattern: '^_'
}],
'@typescript-eslint/no-use-before-define': 'warn',
'@typescript-eslint/prefer-promise-reject-errors': 'warn'
}
},
{
files: ['test/**/*.{js,cjs,mjs,jsx,ts,tsx}'],
languageOptions: {
globals: {
...globals.jest,
...globals.node
}
},
rules: {
'max-len': [
'warn',
// settings copied from eslint-config-scratch.legacy.base
{
code: 120,
tabWidth: 4,
ignoreUrls: true
}
],
'react/prop-types': 'off' // don't worry about prop types in tests
}
},
{
files: ['{src,test}/**/*.{ts,tsx}'],
rules: {
// TODO: get TS parsing to work with eslint-plugin-import
'import/named': 'off'
}
},
{
// disable some checks for these generated files
files: ['{src,test}/**/types.d.ts'],
rules: {
'@stylistic/indent': 'off'
}
},
{
files: [
'src/lib/libraries/extensions/index.jsx',
'src/lib/libraries/decks/*.js'
],
rules: {
// the way these files are built makes duplicate imports the natural way to do things
'no-duplicate-imports': 'off'
}
},
{
files: ['test/unit/util/define-dynamic-block.test.js'],
settings: {
// TODO: figure out why this is needed...
// probably something with eslint-plugin-import's parser or resolver
'import/core-modules': [
'@scratch/scratch-vm/src/extension-support/block-type'
]
}
},
globalIgnores([
'build/**/*',
'dist/**/*',
'node_modules/**/*'
])
);
27 changes: 13 additions & 14 deletions packages/scratch-gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"start": "webpack serve",
"test": "npm run test:lint && npm run test:unit && npm run test:integration",
"test:integration": "cross-env JEST_JUNIT_OUTPUT_NAME=integration-tests-results.xml jest --maxWorkers=4 test[\\\\/]integration",
"test:lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"test:lint": "eslint",
"test:unit": "cross-env JEST_JUNIT_OUTPUT_NAME=unit-tests-results.xml jest test[\\\\/]unit",
"test:smoke": "jest --runInBand test[\\\\/]smoke",
"watch": "webpack --watch"
Expand Down Expand Up @@ -117,8 +117,8 @@
"scratch-storage": "4.0.229",
"startaudiocontext": "1.2.1",
"style-loader": "4.0.0",
"to-style": "1.3.3",
"text-encoding": "0.7.0",
"to-style": "1.3.3",
"wav-encoder": "1.3.0",
"xhr": "2.6.0"
},
Expand All @@ -131,29 +131,27 @@
"devDependencies": {
"@babel/cli": "7.28.3",
"@babel/core": "7.28.4",
"@babel/eslint-parser": "7.28.4",
"@babel/preset-env": "7.28.3",
"@babel/preset-react": "7.27.1",
"@types/jest": "^25.2.3",
"@types/prop-types": "15.7.15",
"@types/react-modal": "3.16.3",
"@typescript-eslint/eslint-plugin": "8.7.0",
"@typescript-eslint/parser": "8.7.0",
"babel-core": "7.0.0-bridge.0",
"babel-loader": "9.2.1",
"buffer": "^6.0.3",
"cheerio": "1.0.0-rc.3",
"cross-env": "7.0.3",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.8",
"eslint": "8.57.1",
"eslint-config-scratch": "9.0.9",
"eslint-import-resolver-webpack": "0.11.1",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-jest": "22.21.0",
"eslint-plugin-react": "7.37.5",
"eslint": "9.35.0",
"eslint-config-scratch": "^12.0.0",
"eslint-import-resolver-webpack": "^0.13.10",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-react": "^7.37.5",
"file-loader": "6.2.0",
"gh-pages": "3.2.3",
"html-webpack-plugin": "5.6.4",
"jest": "21.2.1",
"jest": "^25.5.4",
"jest-junit": "7.0.0",
"mkdirp": "1.0.4",
"raf": "3.4.1",
Expand All @@ -165,7 +163,7 @@
"selenium-webdriver": "3.6.0",
"semantic-release": "19.0.5",
"stream-browserify": "3.0.0",
"ts-jest": "21.2.4",
"ts-jest": "^25.5.1",
Comment on lines -168 to +166
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was surprised to find that I had to update jest and ts-jest to get this all to work. I'm not sure exactly what the interaction was, but once I updated all the eslint-related things, jest started to fail with a parse error.

"ts-loader": "9.5.4",
"url-loader": "4.1.1",
"web-audio-test-api": "0.5.2",
Expand Down Expand Up @@ -200,7 +198,8 @@
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)\\??$": "<rootDir>/test/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/test/__mocks__/styleMock.js",
"editor-msgs(\\.js)?$": "<rootDir>/test/__mocks__/editor-msgs-mock.js"
"editor-msgs(\\.js)?$": "<rootDir>/test/__mocks__/editor-msgs-mock.js",
"^@scratch/scratch-svg-renderer$": "<rootDir>/../scratch-svg-renderer/src/"
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious - why did we end up needing this for svg-renderer, but not for e.g. -vm

},
"moduleFileExtensions": [
"ts",
Expand Down
8 changes: 0 additions & 8 deletions packages/scratch-gui/scripts/.eslintrc.js

This file was deleted.

60 changes: 0 additions & 60 deletions packages/scratch-gui/src/.eslintrc.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const AuthorInfo = ({
imageUrl,
projectTitle,
// TODO: use userId to link to user's profile
userId, // eslint-disable-line no-unused-vars
userId, // eslint-disable-line @typescript-eslint/no-unused-vars
username
}) => (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import styles from './login-dropdown.css';

// these are here as a hack to get them translated, so that equivalent messages will be translated
// when passed in from www via gui's renderLogin() function
const LoginDropdownMessages = defineMessages({ // eslint-disable-line no-unused-vars
const LoginDropdownMessages = defineMessages({ // eslint-disable-line @typescript-eslint/no-unused-vars
username: {
defaultMessage: 'Username',
description: 'Label for login username input',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const OldTimeyMode = props => {
<audio
src={oldtimeySound}
ref={audio => {
audio && (audio.volume = 0.1); // eslint-disable-line no-unused-expressions
audio && (audio.volume = 0.1); // eslint-disable-line @typescript-eslint/no-unused-expressions
}}
autoPlay
loop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const TagButtonComponent = ({
active,
iconClassName,
className,
tag, // eslint-disable-line no-unused-vars
tag, // eslint-disable-line @typescript-eslint/no-unused-vars
intlLabel,
...props
}) => (
Expand Down
2 changes: 1 addition & 1 deletion packages/scratch-gui/src/containers/alert.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Alert extends React.Component {
closeButton,
content,
extensionName,
index, // eslint-disable-line no-unused-vars
index, // eslint-disable-line @typescript-eslint/no-unused-vars
level,
iconSpinner,
iconURL,
Expand Down
2 changes: 1 addition & 1 deletion packages/scratch-gui/src/containers/balanced-text.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class BalancedText extends React.Component {
render () {
let {
children,
resize, // eslint-disable-line no-unused-vars
resize, // eslint-disable-line @typescript-eslint/no-unused-vars
style,
...otherProps
} = this.props;
Expand Down
4 changes: 2 additions & 2 deletions packages/scratch-gui/src/containers/blocks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ class Blocks extends React.Component {
});
}
render () {
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
const {
anyModalVisible,
canUseCloud,
Expand All @@ -569,7 +569,7 @@ class Blocks extends React.Component {
workspaceMetrics,
...props
} = this.props;
/* eslint-enable no-unused-vars */
/* eslint-enable @typescript-eslint/no-unused-vars */
return (
<React.Fragment>
<DroppableBlocks
Expand Down
4 changes: 2 additions & 2 deletions packages/scratch-gui/src/containers/controls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class Controls extends React.Component {
}
render () {
const {
vm, // eslint-disable-line no-unused-vars
isStarted, // eslint-disable-line no-unused-vars
vm, // eslint-disable-line @typescript-eslint/no-unused-vars
isStarted, // eslint-disable-line @typescript-eslint/no-unused-vars
projectRunning,
turbo,
...props
Expand Down
2 changes: 1 addition & 1 deletion packages/scratch-gui/src/containers/costume-tab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class CostumeTab extends React.Component {
}
render () {
const {
dispatchUpdateRestore, // eslint-disable-line no-unused-vars
dispatchUpdateRestore, // eslint-disable-line @typescript-eslint/no-unused-vars
intl,
isRtl,
vm
Expand Down
4 changes: 2 additions & 2 deletions packages/scratch-gui/src/containers/deletion-restorer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ class DeletionRestorer extends React.Component {
}
render () {
const {
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
children,
dispatchUpdateRestore,
/* eslint-enable no-unused-vars */
/* eslint-enable @typescript-eslint/no-unused-vars */
...props
} = this.props;
const restorable = typeof this.props.restore === 'function';
Expand Down
Loading
Loading