Skip to content
Draft
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
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ build-debug.log
tsdoc-metadata.json
.vscode

# All packages
build/
dist/
packages/*/test/**/*.d.ts
packages/*/test/**/*.d.ts.map

# Core
packages/blockly/tests/compile/main_compressed.js
packages/blockly/tests/compile/main_compressed.js.map
packages/blockly/build/
packages/blockly/dist/
packages/blockly/temp/

# Docs:
# Autogenerated reference docs, do not check in
packages/docs/docs/reference/
packages/docs/.docusaurus
packages/docs/build/
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
eslint.config.mjs
package.json

# Package build aritifacts, etc.
**/dist/*
**/build/*
**/node_modules/*
**/package-lock.json
**/CHANGELOG.md

# Core: Build Artifacts
packages/blockly/msg/*
packages/blockly/build/*
Expand Down
14 changes: 14 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,19 @@ module.exports = {
'plugins': ['prettier-plugin-organize-imports'],
},
},
{
files: [
'packages/theme-*/**/*',
'packages/dev-tools/**/*'
],
options: {
// Some properties must be quoted to preserve closure compiler behavior.
// If at least one property in an object requires quotes, quote all
// properties.
quoteProps: 'consistent',
// Don't add spaces around braces for object literals.
bracketSpacing: false,
},
},
],
};
140 changes: 99 additions & 41 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import {defineConfig} from 'eslint/config';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import eslintConfigPrettier from 'eslint-config-prettier';

// These rules are no longer supported, but the Google style package we depend
// on hasn't been updated in years to remove them, even though they have been
Expand Down Expand Up @@ -139,13 +140,15 @@ export default defineConfig(
{
// Note: there should be no other properties in this object
ignores: [
// Build artifacts
// All Packages
'packages/*/node_modules/**',
'packages/**/build/',
'packages/**/dist/',
// Core Build artifacts
'packages/blockly/msg/*',
'packages/blockly/build/*',
'packages/blockly/dist/*',
'packages/blockly/typings/*',
'packages/blockly/docs/*',
// Tests other than mocha unit tests
// Core Tests other than mocha unit tests
'packages/blockly/tests/blocks/*',
'packages/blockly/tests/themes/*',
'packages/blockly/tests/compile/*',
Expand All @@ -155,8 +158,7 @@ export default defineConfig(
'packages/blockly/tests/screenshot/*',
'packages/blockly/tests/test_runner.js',
'packages/blockly/tests/workspace_svg/*',
// Demos, scripts, misc
'packages/blockly/node_modules/*',
// Core Demos, scripts, misc
'packages/blockly/generators/*',
'packages/blockly/demos/*',
'packages/blockly/appengine/*',
Expand All @@ -167,53 +169,19 @@ export default defineConfig(
'packages/blockly/PULL_REQUEST_TEMPLATE.md',
// Docs
'packages/docs/docs/reference/**',
'packages/docs/build/**',
'packages/docs/.docusaurus/**',
'packages/docs/node_modules/**',
],
},
jsdoc.configs['flat/recommended'],
{
files: ['packages/blockly/**/*.ts', 'packages/blockly/**/*.tsx', 'packages/blockly/**/*.js'],
extends: [eslint.configs.recommended, googleStyle],
languageOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
settings: {
// Allowlist some JSDoc tag aliases we use.
'jsdoc': {
'tagNamePreference': {
'return': 'return',
'fileoverview': 'fileoverview',
'extends': 'extends',
'constructor': 'constructor',
},
},
},
rules,
// Per the docs, this should be at the end because it disables rules that
// conflict with Prettier.
extends: [eslint.configs.recommended, googleStyle],
...eslintPluginPrettierRecommended,
},
{
languageOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
settings: {
// Allowlist some JSDoc tag aliases we use.
'jsdoc': {
'tagNamePreference': {
'return': 'return',
'fileoverview': 'fileoverview',
'extends': 'extends',
'constructor': 'constructor',
},
},
},
rules,
},
{
files: [
'packages/blockly/eslint.config.mjs',
Expand Down Expand Up @@ -353,6 +321,96 @@ export default defineConfig(
'mdx/remark': 'off',
},
},
{
files: [
'packages/theme-*/**',
'packages/dev-tools/**'
],
languageOptions: {
globals: {
...globals.browser,
...globals.commonjs,
...globals.node,
...globals.es5,
Blockly: true,
goog: true,
monaco: true,
dat: true,
},
},
linterOptions: {
reportUnusedDisableDirectives: true,
},
plugins: {
jsdoc,
},
settings: {
jsdoc: {
tagNamePreference: {
returns: 'returns',
},
mode: 'closure',
},
},
rules: {
// http://eslint.org/docs/rules/
'camelcase': 'warn',
'new-cap': ['error', {capIsNewExceptionPattern: '^.*Error'}],
'no-invalid-this': 'off',
// valid-jsdoc does not work properly for interface methods.
// https://github.com/eslint/eslint/issues/9978
'valid-jsdoc': 'off',
// https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules
'require-jsdoc': 'off',
'jsdoc/newline-after-description': 'off',
// This should warn instead, but it's broken for long record type params.
'jsdoc/require-description-complete-sentence': 'off',
'jsdoc/require-returns': [
'error',
{
forceRequireReturn: false,
},
],
'jsdoc/require-description': [
'warn',
{
// Don't require descriptions if these tags are present.
exemptedBy: ['inheritdoc', 'param', 'return', 'returns', 'type'],
},
],
'jsdoc/check-tag-names': 'off',
'jsdoc/check-access': 'warn',
'jsdoc/check-types': 'off',
'jsdoc/check-values': 'off',
'jsdoc/reject-any-type': 'off',
'jsdoc/reject-function-type': 'off',
'jsdoc/require-jsdoc': [
'warn',
{
enableFixer: false,
require: {
FunctionDeclaration: true,
ClassDeclaration: true,
MethodDefinition: true,
},
},
],
}
},
{
settings: {
// Allowlist some JSDoc tag aliases we use.
'jsdoc': {
'tagNamePreference': {
'return': 'return',
'fileoverview': 'fileoverview',
'extends': 'extends',
'constructor': 'constructor',
},
},
},
rules,
},
...tseslint.config(
buildTSOverride({
files: ['packages/blockly/**/*.ts', 'packages/blockly/**/*.tsx'],
Expand Down
Loading
Loading