mirror of
https://github.com/scratchfoundation/eslint-config-scratch.git
synced 2025-08-28 22:40:13 -04:00
style: prettier --write .
This commit is contained in:
parent
d7ffee5f62
commit
f96889d13e
13 changed files with 391 additions and 342 deletions
20
.github/workflows/deploy.yml
vendored
20
.github/workflows/deploy.yml
vendored
|
@ -15,18 +15,18 @@ jobs:
|
||||||
- uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6
|
- uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6
|
||||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||||
with:
|
with:
|
||||||
cache: "npm"
|
cache: 'npm'
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: '.nvmrc'
|
||||||
- name: Info
|
- name: Info
|
||||||
run: |
|
run: |
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Node version: $(node --version)
|
Node version: $(node --version)
|
||||||
NPM version: $(npm --version)
|
NPM version: $(npm --version)
|
||||||
github.event.pull_request.head.label: ${{ github.event.pull_request.head.label }}
|
github.event.pull_request.head.label: ${{ github.event.pull_request.head.label }}
|
||||||
github.head_ref: ${{ github.head_ref }}
|
github.head_ref: ${{ github.head_ref }}
|
||||||
github.ref: ${{ github.ref }}
|
github.ref: ${{ github.ref }}
|
||||||
github.workflow: ${{ github.workflow }}
|
github.workflow: ${{ github.workflow }}
|
||||||
EOF
|
EOF
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
- name: Semantic Release
|
- name: Semantic Release
|
||||||
|
|
6
.github/workflows/signature-assistant.yml
vendored
6
.github/workflows/signature-assistant.yml
vendored
|
@ -1,9 +1,9 @@
|
||||||
name: "Signature Assistant"
|
name: 'Signature Assistant'
|
||||||
on:
|
on:
|
||||||
issue_comment:
|
issue_comment:
|
||||||
types: [created]
|
types: [created]
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [opened,closed,synchronize]
|
types: [opened, closed, synchronize]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
actions: write
|
actions: write
|
||||||
|
@ -15,7 +15,7 @@ jobs:
|
||||||
CLA-Assistant:
|
CLA-Assistant:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: "CLA Assistant"
|
- name: 'CLA Assistant'
|
||||||
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
|
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
|
||||||
uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.1
|
uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.1
|
||||||
env:
|
env:
|
||||||
|
|
61
README.md
61
README.md
|
@ -22,10 +22,10 @@ TODO: update this section!!!
|
||||||
|
|
||||||
The configuration is split up into several modules:
|
The configuration is split up into several modules:
|
||||||
|
|
||||||
* `eslint-config-scratch`: The base configuration, not configured for any particular environment
|
- `eslint-config-scratch`: The base configuration, not configured for any particular environment
|
||||||
* `eslint-config-scratch/node`: Rules for targeting Node.js with ESM
|
- `eslint-config-scratch/node`: Rules for targeting Node.js with ESM
|
||||||
* `eslint-config-scratch/web`: Rules for targeting Scratch's supported web browsers
|
- `eslint-config-scratch/web`: Rules for targeting Scratch's supported web browsers
|
||||||
* `eslint-config-scratch/react`: Rules for targeting Scratch's supported web browsers with React
|
- `eslint-config-scratch/react`: Rules for targeting Scratch's supported web browsers with React
|
||||||
|
|
||||||
These configurations are set up for the flat config format required as of `eslint@^9`.
|
These configurations are set up for the flat config format required as of `eslint@^9`.
|
||||||
|
|
||||||
|
@ -48,23 +48,24 @@ Your config files should be set up like
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// scratch-project/eslint.config.mjs
|
// scratch-project/eslint.config.mjs
|
||||||
import nodeConfig from 'eslint-config-scratch/node';
|
import nodeConfig from 'eslint-config-scratch/node'
|
||||||
export default nodeConfig;
|
|
||||||
|
export default nodeConfig
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// scratch-project/src/eslint.config.mjs
|
// scratch-project/src/eslint.config.mjs
|
||||||
import webConfig from 'eslint-config-scratch/web';
|
import webConfig from 'eslint-config-scratch/web'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
webConfig,
|
webConfig,
|
||||||
// If you need to add or override settings:
|
// If you need to add or override settings:
|
||||||
{
|
{
|
||||||
rules: {
|
rules: {
|
||||||
// ...
|
// ...
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
];
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
This will set up all the files in the project for linting as Node.js by default,
|
This will set up all the files in the project for linting as Node.js by default,
|
||||||
|
@ -84,10 +85,10 @@ just use this:
|
||||||
Scratch used very different styling rules in `eslint-config-scratch@^9` and below. If you need to use those rules, you
|
Scratch used very different styling rules in `eslint-config-scratch@^9` and below. If you need to use those rules, you
|
||||||
can use the rule sets under `legacy/`:
|
can use the rule sets under `legacy/`:
|
||||||
|
|
||||||
* `eslint-config-scratch/legacy`: Legacy base configuration, not configured for any particular environment
|
- `eslint-config-scratch/legacy`: Legacy base configuration, not configured for any particular environment
|
||||||
* `eslint-config-scratch/legacy/es6`: Legacy rules for targeting Scratch's supported web browsers
|
- `eslint-config-scratch/legacy/es6`: Legacy rules for targeting Scratch's supported web browsers
|
||||||
* `eslint-config-scratch/legacy/node`: Legacy rules for targeting Node.js
|
- `eslint-config-scratch/legacy/node`: Legacy rules for targeting Node.js
|
||||||
* `eslint-config-scratch/legacy/react`: Legacy rules for targeting Scratch's supported web browsers with React
|
- `eslint-config-scratch/legacy/react`: Legacy rules for targeting Scratch's supported web browsers with React
|
||||||
|
|
||||||
New projects should not use these rule sets. They may disappear in the future.
|
New projects should not use these rule sets. They may disappear in the future.
|
||||||
|
|
||||||
|
@ -115,16 +116,16 @@ applicable.
|
||||||
|
|
||||||
`type` is one of:
|
`type` is one of:
|
||||||
|
|
||||||
* `fix`: A bug fix **Causes a patch release (0.0.x)**
|
- `fix`: A bug fix **Causes a patch release (0.0.x)**
|
||||||
* `feat`: A new feature **Causes a minor release (0.x.0)**
|
- `feat`: A new feature **Causes a minor release (0.x.0)**
|
||||||
* `docs`: Documentation only changes
|
- `docs`: Documentation only changes
|
||||||
* `style`: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
- `style`: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
||||||
* `refactor`: A code change that neither fixes a bug nor adds a feature
|
- `refactor`: A code change that neither fixes a bug nor adds a feature
|
||||||
* `perf`: A code change that improves performance **May or may not cause a minor release. It's not clear.**
|
- `perf`: A code change that improves performance **May or may not cause a minor release. It's not clear.**
|
||||||
* `test`: Adding missing tests or correcting existing tests
|
- `test`: Adding missing tests or correcting existing tests
|
||||||
* `ci`: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
- `ci`: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||||
* `chore`: Other changes that don't modify src or test files
|
- `chore`: Other changes that don't modify src or test files
|
||||||
* `revert`: Reverts a previous commit
|
- `revert`: Reverts a previous commit
|
||||||
|
|
||||||
Use the [commitizen CLI](https://github.com/commitizen/cz-cli) to make commits
|
Use the [commitizen CLI](https://github.com/commitizen/cz-cli) to make commits
|
||||||
formatted in this way:
|
formatted in this way:
|
||||||
|
@ -140,6 +141,6 @@ Now you're ready to make commits using `git cz`.
|
||||||
|
|
||||||
If you're committing a change that makes the linter more strict, or will
|
If you're committing a change that makes the linter more strict, or will
|
||||||
otherwise require changes to existing code, ensure your commit specifies a
|
otherwise require changes to existing code, ensure your commit specifies a
|
||||||
breaking change. In your commit body, prefix the changes with "BREAKING CHANGE: "
|
breaking change. In your commit body, prefix the changes with "BREAKING CHANGE: "
|
||||||
This will cause a major version bump so downstream projects must choose to upgrade
|
This will cause a major version bump so downstream projects must choose to upgrade
|
||||||
the config and will not break the build unexpectedly.
|
the config and will not break the build unexpectedly.
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
* @type {import('@commitlint/types').UserConfig}
|
* @type {import('@commitlint/types').UserConfig}
|
||||||
*/
|
*/
|
||||||
export default {
|
export default {
|
||||||
extends: ['@commitlint/config-conventional'],
|
extends: ['@commitlint/config-conventional'],
|
||||||
ignores: [message => message.startsWith('chore(release):')]
|
ignores: [message => message.startsWith('chore(release):')],
|
||||||
};
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import defaults from './lib/index.mjs';
|
import defaults from './lib/index.mjs'
|
||||||
|
|
||||||
export default defaults;
|
export default defaults
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
|
import eslintConfigPrettier from 'eslint-config-prettier/flat'
|
||||||
import eslintConfigPrettier from 'eslint-config-prettier/flat';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import('eslint').Linter.Config[]}
|
* @type {import('eslint').Linter.Config[]}
|
||||||
*/
|
*/
|
||||||
const eslintConfigScratch = [
|
const eslintConfigScratch = [
|
||||||
eslintConfigPrettier, // keep this last to turn off rules that conflict with Prettier
|
eslintConfigPrettier, // keep this last to turn off rules that conflict with Prettier
|
||||||
];
|
]
|
||||||
|
|
||||||
export default eslintConfigScratch;
|
export default eslintConfigScratch
|
||||||
|
|
|
@ -1,164 +1,192 @@
|
||||||
import globals from 'globals';
|
import jsdoc from 'eslint-plugin-jsdoc'
|
||||||
import babelParser from '@babel/eslint-parser';
|
import globals from 'globals'
|
||||||
import path from 'node:path';
|
import path from 'node:path'
|
||||||
import {fileURLToPath} from 'node:url';
|
import { fileURLToPath } from 'node:url'
|
||||||
import js from '@eslint/js';
|
import babelParser from '@babel/eslint-parser'
|
||||||
import {FlatCompat} from '@eslint/eslintrc';
|
import { FlatCompat } from '@eslint/eslintrc'
|
||||||
import jsdoc from 'eslint-plugin-jsdoc';
|
import js from '@eslint/js'
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url)
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename)
|
||||||
const compat = new FlatCompat({
|
const compat = new FlatCompat({
|
||||||
baseDirectory: __dirname,
|
baseDirectory: __dirname,
|
||||||
recommendedConfig: js.configs.recommended,
|
recommendedConfig: js.configs.recommended,
|
||||||
allConfig: js.configs.all
|
allConfig: js.configs.all,
|
||||||
});
|
})
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
...compat.extends('eslint:recommended'),
|
...compat.extends('eslint:recommended'),
|
||||||
jsdoc.configs['flat/recommended'],
|
jsdoc.configs['flat/recommended'],
|
||||||
{
|
{
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
globals: {
|
globals: {
|
||||||
...globals.commonjs
|
...globals.commonjs,
|
||||||
},
|
},
|
||||||
|
|
||||||
parser: babelParser,
|
parser: babelParser,
|
||||||
ecmaVersion: 6,
|
ecmaVersion: 6,
|
||||||
sourceType: 'script',
|
sourceType: 'script',
|
||||||
|
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
requireConfigFile: false
|
requireConfigFile: false,
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
'array-callback-return': [2],
|
||||||
|
'block-scoped-var': [2],
|
||||||
|
curly: [2, 'multi-line'],
|
||||||
|
'dot-location': [2, 'property'],
|
||||||
|
'dot-notation': [2],
|
||||||
|
eqeqeq: [2],
|
||||||
|
'no-alert': [2],
|
||||||
|
'no-div-regex': [2],
|
||||||
|
'no-else-return': [2],
|
||||||
|
'no-eq-null': [2],
|
||||||
|
'no-eval': [2],
|
||||||
|
'no-extend-native': [2],
|
||||||
|
'no-extra-bind': [2],
|
||||||
|
'no-global-assign': [2],
|
||||||
|
'no-implied-eval': [2],
|
||||||
|
'no-invalid-this': [2],
|
||||||
|
'no-iterator': [2],
|
||||||
|
'no-lone-blocks': [2],
|
||||||
|
'no-loop-func': [2],
|
||||||
|
'no-multi-spaces': [2],
|
||||||
|
'no-multi-str': [2],
|
||||||
|
'no-new': [2],
|
||||||
|
'no-proto': [2],
|
||||||
|
'no-return-assign': [2],
|
||||||
|
'no-script-url': [2],
|
||||||
|
'no-self-compare': [2],
|
||||||
|
'no-sequences': [2],
|
||||||
|
'no-throw-literal': [2],
|
||||||
|
'no-unmodified-loop-condition': [2],
|
||||||
|
'no-unused-expressions': [2],
|
||||||
|
'no-useless-call': [2],
|
||||||
|
'no-useless-concat': [2],
|
||||||
|
'no-useless-escape': [2],
|
||||||
|
'no-warning-comments': [0],
|
||||||
|
'no-with': [2],
|
||||||
|
radix: [2],
|
||||||
|
'wrap-iife': [2],
|
||||||
|
yoda: [2],
|
||||||
|
|
||||||
|
'no-unused-vars': [
|
||||||
|
2,
|
||||||
|
{
|
||||||
|
args: 'after-used',
|
||||||
|
varsIgnorePattern: '^_',
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
|
||||||
rules: {
|
'no-catch-shadow': [2],
|
||||||
'array-callback-return': [2],
|
'no-shadow': [2],
|
||||||
'block-scoped-var': [2],
|
'no-undefined': [2],
|
||||||
'curly': [2, 'multi-line'],
|
'no-use-before-define': [2],
|
||||||
'dot-location': [2, 'property'],
|
strict: [2, 'never'],
|
||||||
'dot-notation': [2],
|
'array-bracket-spacing': [2, 'never'],
|
||||||
'eqeqeq': [2],
|
'block-spacing': [2, 'always'],
|
||||||
'no-alert': [2],
|
'brace-style': [2],
|
||||||
'no-div-regex': [2],
|
|
||||||
'no-else-return': [2],
|
|
||||||
'no-eq-null': [2],
|
|
||||||
'no-eval': [2],
|
|
||||||
'no-extend-native': [2],
|
|
||||||
'no-extra-bind': [2],
|
|
||||||
'no-global-assign': [2],
|
|
||||||
'no-implied-eval': [2],
|
|
||||||
'no-invalid-this': [2],
|
|
||||||
'no-iterator': [2],
|
|
||||||
'no-lone-blocks': [2],
|
|
||||||
'no-loop-func': [2],
|
|
||||||
'no-multi-spaces': [2],
|
|
||||||
'no-multi-str': [2],
|
|
||||||
'no-new': [2],
|
|
||||||
'no-proto': [2],
|
|
||||||
'no-return-assign': [2],
|
|
||||||
'no-script-url': [2],
|
|
||||||
'no-self-compare': [2],
|
|
||||||
'no-sequences': [2],
|
|
||||||
'no-throw-literal': [2],
|
|
||||||
'no-unmodified-loop-condition': [2],
|
|
||||||
'no-unused-expressions': [2],
|
|
||||||
'no-useless-call': [2],
|
|
||||||
'no-useless-concat': [2],
|
|
||||||
'no-useless-escape': [2],
|
|
||||||
'no-warning-comments': [0],
|
|
||||||
'no-with': [2],
|
|
||||||
'radix': [2],
|
|
||||||
'wrap-iife': [2],
|
|
||||||
'yoda': [2],
|
|
||||||
|
|
||||||
'no-unused-vars': [2, {
|
camelcase: [
|
||||||
args: 'after-used',
|
2,
|
||||||
varsIgnorePattern: '^_'
|
{
|
||||||
}],
|
properties: 'never',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'no-catch-shadow': [2],
|
'comma-dangle': [2, 'never'],
|
||||||
'no-shadow': [2],
|
'comma-spacing': [2],
|
||||||
'no-undefined': [2],
|
'comma-style': [2],
|
||||||
'no-use-before-define': [2],
|
'eol-last': [2, 'always'],
|
||||||
'strict': [2, 'never'],
|
'func-call-spacing': [2, 'never'],
|
||||||
'array-bracket-spacing': [2, 'never'],
|
'func-style': [2, 'expression'],
|
||||||
'block-spacing': [2, 'always'],
|
indent: [2, 4],
|
||||||
'brace-style': [2],
|
'jsx-quotes': [2, 'prefer-double'],
|
||||||
|
|
||||||
'camelcase': [2, {
|
'key-spacing': [
|
||||||
properties: 'never'
|
2,
|
||||||
}],
|
{
|
||||||
|
beforeColon: false,
|
||||||
|
afterColon: true,
|
||||||
|
mode: 'strict',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'comma-dangle': [2, 'never'],
|
'keyword-spacing': [
|
||||||
'comma-spacing': [2],
|
2,
|
||||||
'comma-style': [2],
|
{
|
||||||
'eol-last': [2, 'always'],
|
before: true,
|
||||||
'func-call-spacing': [2, 'never'],
|
after: true,
|
||||||
'func-style': [2, 'expression'],
|
},
|
||||||
'indent': [2, 4],
|
],
|
||||||
'jsx-quotes': [2, 'prefer-double'],
|
|
||||||
|
|
||||||
'key-spacing': [2, {
|
'linebreak-style': [2, 'unix'],
|
||||||
beforeColon: false,
|
|
||||||
afterColon: true,
|
|
||||||
mode: 'strict'
|
|
||||||
}],
|
|
||||||
|
|
||||||
'keyword-spacing': [2, {
|
'max-len': [
|
||||||
before: true,
|
2,
|
||||||
after: true
|
{
|
||||||
}],
|
code: 120,
|
||||||
|
tabWidth: 4,
|
||||||
|
ignoreUrls: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'linebreak-style': [2, 'unix'],
|
'new-parens': [2],
|
||||||
|
'newline-per-chained-call': [2],
|
||||||
|
'no-lonely-if': [2],
|
||||||
|
'no-mixed-operators': [2],
|
||||||
|
|
||||||
'max-len': [2, {
|
'no-multiple-empty-lines': [
|
||||||
code: 120,
|
2,
|
||||||
tabWidth: 4,
|
{
|
||||||
ignoreUrls: true
|
max: 2,
|
||||||
}],
|
maxBOF: 0,
|
||||||
|
maxEOF: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'new-parens': [2],
|
'no-negated-condition': [2],
|
||||||
'newline-per-chained-call': [2],
|
'no-tabs': [2],
|
||||||
'no-lonely-if': [2],
|
|
||||||
'no-mixed-operators': [2],
|
|
||||||
|
|
||||||
'no-multiple-empty-lines': [2, {
|
'no-trailing-spaces': [
|
||||||
max: 2,
|
2,
|
||||||
maxBOF: 0,
|
{
|
||||||
maxEOF: 0
|
skipBlankLines: true,
|
||||||
}],
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'no-negated-condition': [2],
|
'no-unneeded-ternary': [2],
|
||||||
'no-tabs': [2],
|
'object-curly-spacing': [2],
|
||||||
|
|
||||||
'no-trailing-spaces': [2, {
|
'object-property-newline': [
|
||||||
skipBlankLines: true
|
2,
|
||||||
}],
|
{
|
||||||
|
allowMultiplePropertiesPerLine: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'no-unneeded-ternary': [2],
|
'one-var': [2, 'never'],
|
||||||
'object-curly-spacing': [2],
|
'operator-linebreak': [2, 'after'],
|
||||||
|
'quote-props': [2, 'consistent-as-needed'],
|
||||||
|
|
||||||
'object-property-newline': [2, {
|
quotes: [
|
||||||
allowMultiplePropertiesPerLine: true
|
2,
|
||||||
}],
|
'single',
|
||||||
|
{
|
||||||
|
allowTemplateLiterals: true,
|
||||||
|
avoidEscape: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'one-var': [2, 'never'],
|
semi: [2, 'always'],
|
||||||
'operator-linebreak': [2, 'after'],
|
'semi-spacing': [2],
|
||||||
'quote-props': [2, 'consistent-as-needed'],
|
'space-before-function-paren': [2, 'always'],
|
||||||
|
'space-in-parens': [2],
|
||||||
'quotes': [2, 'single', {
|
'space-infix-ops': [2],
|
||||||
allowTemplateLiterals: true,
|
'space-unary-ops': [2],
|
||||||
avoidEscape: true
|
'spaced-comment': [2],
|
||||||
}],
|
},
|
||||||
|
},
|
||||||
'semi': [2, 'always'],
|
]
|
||||||
'semi-spacing': [2],
|
|
||||||
'space-before-function-paren': [2, 'always'],
|
|
||||||
'space-in-parens': [2],
|
|
||||||
'space-infix-ops': [2],
|
|
||||||
'space-unary-ops': [2],
|
|
||||||
'spaced-comment': [2]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
import globals from 'globals';
|
import globals from 'globals'
|
||||||
|
|
||||||
export default [{
|
export default [
|
||||||
|
{
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
globals: {
|
globals: {
|
||||||
...globals.node
|
...globals.node,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
'global-require': [2],
|
'global-require': [2],
|
||||||
'handle-callback-err': [2],
|
'handle-callback-err': [2],
|
||||||
'no-mixed-requires': [2],
|
'no-mixed-requires': [2],
|
||||||
'no-new-require': [2],
|
'no-new-require': [2],
|
||||||
'no-path-concat': [2]
|
'no-path-concat': [2],
|
||||||
}
|
},
|
||||||
}];
|
},
|
||||||
|
]
|
||||||
|
|
|
@ -1,85 +1,100 @@
|
||||||
import react from 'eslint-plugin-react';
|
import react from 'eslint-plugin-react'
|
||||||
import path from 'node:path';
|
import path from 'node:path'
|
||||||
import {fileURLToPath} from 'node:url';
|
import { fileURLToPath } from 'node:url'
|
||||||
import js from '@eslint/js';
|
import { FlatCompat } from '@eslint/eslintrc'
|
||||||
import {FlatCompat} from '@eslint/eslintrc';
|
import js from '@eslint/js'
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url)
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename)
|
||||||
const compat = new FlatCompat({
|
const compat = new FlatCompat({
|
||||||
baseDirectory: __dirname,
|
baseDirectory: __dirname,
|
||||||
recommendedConfig: js.configs.recommended,
|
recommendedConfig: js.configs.recommended,
|
||||||
allConfig: js.configs.all
|
allConfig: js.configs.all,
|
||||||
});
|
})
|
||||||
|
|
||||||
export default [...compat.extends('plugin:react/recommended'), {
|
export default [
|
||||||
|
...compat.extends('plugin:react/recommended'),
|
||||||
|
{
|
||||||
plugins: {
|
plugins: {
|
||||||
react
|
react,
|
||||||
},
|
},
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
'react/display-name': [2],
|
'react/display-name': [2],
|
||||||
'react/forbid-prop-types': [2],
|
'react/forbid-prop-types': [2],
|
||||||
'react/no-children-prop': [2],
|
'react/no-children-prop': [2],
|
||||||
'react/no-danger': [2],
|
'react/no-danger': [2],
|
||||||
'react/no-danger-with-children': [2],
|
'react/no-danger-with-children': [2],
|
||||||
'react/no-deprecated': [2],
|
'react/no-deprecated': [2],
|
||||||
'react/no-did-mount-set-state': [2],
|
'react/no-did-mount-set-state': [2],
|
||||||
'react/no-did-update-set-state': [2],
|
'react/no-did-update-set-state': [2],
|
||||||
'react/no-direct-mutation-state': [2],
|
'react/no-direct-mutation-state': [2],
|
||||||
'react/no-find-dom-node': [2],
|
'react/no-find-dom-node': [2],
|
||||||
'react/no-is-mounted': [2],
|
'react/no-is-mounted': [2],
|
||||||
|
|
||||||
'react/no-multi-comp': [2, {
|
'react/no-multi-comp': [
|
||||||
ignoreStateless: true
|
2,
|
||||||
}],
|
{
|
||||||
|
ignoreStateless: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'react/no-render-return-value': [2],
|
'react/no-render-return-value': [2],
|
||||||
'react/no-set-state': [0],
|
'react/no-set-state': [0],
|
||||||
'react/no-string-refs': [2],
|
'react/no-string-refs': [2],
|
||||||
'react/no-unescaped-entities': [2],
|
'react/no-unescaped-entities': [2],
|
||||||
'react/no-unknown-property': [2],
|
'react/no-unknown-property': [2],
|
||||||
'react/no-unused-prop-types': [2],
|
'react/no-unused-prop-types': [2],
|
||||||
'react/prefer-es6-class': [2],
|
'react/prefer-es6-class': [2],
|
||||||
'react/prefer-stateless-function': [2],
|
'react/prefer-stateless-function': [2],
|
||||||
'react/prop-types': [2],
|
'react/prop-types': [2],
|
||||||
'react/react-in-jsx-scope': [2],
|
'react/react-in-jsx-scope': [2],
|
||||||
'react/require-optimization': [0],
|
'react/require-optimization': [0],
|
||||||
'react/require-render-return': [2],
|
'react/require-render-return': [2],
|
||||||
'react/self-closing-comp': [2],
|
'react/self-closing-comp': [2],
|
||||||
'react/sort-comp': [2],
|
'react/sort-comp': [2],
|
||||||
'react/style-prop-object': [2],
|
'react/style-prop-object': [2],
|
||||||
'react/jsx-boolean-value': [2, 'never'],
|
'react/jsx-boolean-value': [2, 'never'],
|
||||||
'react/jsx-closing-bracket-location': [2, 'line-aligned'],
|
'react/jsx-closing-bracket-location': [2, 'line-aligned'],
|
||||||
'react/jsx-curly-spacing': [2],
|
'react/jsx-curly-spacing': [2],
|
||||||
'react/jsx-equals-spacing': [2],
|
'react/jsx-equals-spacing': [2],
|
||||||
'react/jsx-filename-extension': [2],
|
'react/jsx-filename-extension': [2],
|
||||||
'react/jsx-first-prop-new-line': [2, 'multiline'],
|
'react/jsx-first-prop-new-line': [2, 'multiline'],
|
||||||
'react/jsx-handler-names': [2],
|
'react/jsx-handler-names': [2],
|
||||||
'react/jsx-indent': [2],
|
'react/jsx-indent': [2],
|
||||||
'react/jsx-indent-props': [2],
|
'react/jsx-indent-props': [2],
|
||||||
'react/jsx-key': [2],
|
'react/jsx-key': [2],
|
||||||
|
|
||||||
'react/jsx-max-props-per-line': [2, {
|
'react/jsx-max-props-per-line': [
|
||||||
maximum: 1
|
2,
|
||||||
}],
|
{
|
||||||
|
maximum: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'react/jsx-no-bind': [2, {
|
'react/jsx-no-bind': [
|
||||||
ignoreRefs: true
|
2,
|
||||||
}],
|
{
|
||||||
|
ignoreRefs: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'react/jsx-no-comment-textnodes': [2],
|
'react/jsx-no-comment-textnodes': [2],
|
||||||
'react/jsx-no-duplicate-props': [2],
|
'react/jsx-no-duplicate-props': [2],
|
||||||
'react/jsx-no-target-blank': [2],
|
'react/jsx-no-target-blank': [2],
|
||||||
'react/jsx-no-undef': [2],
|
'react/jsx-no-undef': [2],
|
||||||
|
|
||||||
'react/jsx-pascal-case': [2, {
|
'react/jsx-pascal-case': [
|
||||||
allowAllCaps: true
|
2,
|
||||||
}],
|
{
|
||||||
|
allowAllCaps: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'react/jsx-tag-spacing': [2],
|
'react/jsx-tag-spacing': [2],
|
||||||
'react/jsx-uses-react': [2],
|
'react/jsx-uses-react': [2],
|
||||||
'react/jsx-uses-vars': [2],
|
'react/jsx-uses-vars': [2],
|
||||||
'react/jsx-wrap-multilines': [2]
|
'react/jsx-wrap-multilines': [2],
|
||||||
}
|
},
|
||||||
}];
|
},
|
||||||
|
]
|
||||||
|
|
|
@ -1,42 +1,50 @@
|
||||||
export default [{
|
export default [
|
||||||
|
{
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
globals: {},
|
globals: {},
|
||||||
ecmaVersion: 2018,
|
ecmaVersion: 2018,
|
||||||
sourceType: 'script'
|
sourceType: 'script',
|
||||||
},
|
},
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
'arrow-body-style': [2, 'as-needed'],
|
'arrow-body-style': [2, 'as-needed'],
|
||||||
'arrow-parens': [2, 'as-needed'],
|
'arrow-parens': [2, 'as-needed'],
|
||||||
|
|
||||||
'arrow-spacing': [2, {
|
'arrow-spacing': [
|
||||||
before: true,
|
2,
|
||||||
after: true
|
{
|
||||||
}],
|
before: true,
|
||||||
|
after: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'no-prototype-builtins': [2],
|
'no-prototype-builtins': [2],
|
||||||
'no-confusing-arrow': [2],
|
'no-confusing-arrow': [2],
|
||||||
'no-duplicate-imports': [2],
|
'no-duplicate-imports': [2],
|
||||||
'no-return-await': [2],
|
'no-return-await': [2],
|
||||||
'no-template-curly-in-string': [2],
|
'no-template-curly-in-string': [2],
|
||||||
'no-useless-computed-key': [2],
|
'no-useless-computed-key': [2],
|
||||||
'no-useless-constructor': [2],
|
'no-useless-constructor': [2],
|
||||||
'no-useless-rename': [2],
|
'no-useless-rename': [2],
|
||||||
'no-var': [2],
|
'no-var': [2],
|
||||||
'prefer-arrow-callback': [2],
|
'prefer-arrow-callback': [2],
|
||||||
|
|
||||||
'prefer-const': [2, {
|
'prefer-const': [
|
||||||
destructuring: 'all'
|
2,
|
||||||
}],
|
{
|
||||||
|
destructuring: 'all',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'prefer-promise-reject-errors': [2],
|
'prefer-promise-reject-errors': [2],
|
||||||
'prefer-rest-params': [2],
|
'prefer-rest-params': [2],
|
||||||
'prefer-spread': [2],
|
'prefer-spread': [2],
|
||||||
'prefer-template': [2],
|
'prefer-template': [2],
|
||||||
'require-atomic-updates': [2],
|
'require-atomic-updates': [2],
|
||||||
'require-await': [2],
|
'require-await': [2],
|
||||||
'rest-spread-spacing': [2, 'never'],
|
'rest-spread-spacing': [2, 'never'],
|
||||||
'symbol-description': [2],
|
'symbol-description': [2],
|
||||||
'template-curly-spacing': [2, 'never']
|
'template-curly-spacing': [2, 'never'],
|
||||||
}
|
},
|
||||||
}];
|
},
|
||||||
|
]
|
||||||
|
|
|
@ -1,27 +1,25 @@
|
||||||
import sortImports from '@trivago/prettier-plugin-sort-imports';
|
import sortImports from '@trivago/prettier-plugin-sort-imports'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see https://prettier.io/docs/configuration
|
* @see https://prettier.io/docs/configuration
|
||||||
* @type {import("prettier").Config}
|
* @type {import("prettier").Config}
|
||||||
*/
|
*/
|
||||||
const prettierConfig = {
|
const prettierConfig = {
|
||||||
// #region Prettier
|
// #region Prettier
|
||||||
arrowParens: 'avoid',
|
arrowParens: 'avoid',
|
||||||
bracketSameLine: false,
|
bracketSameLine: false,
|
||||||
bracketSpacing: true,
|
bracketSpacing: true,
|
||||||
plugins: [
|
plugins: [sortImports],
|
||||||
sortImports
|
printWidth: 118,
|
||||||
],
|
semi: false,
|
||||||
printWidth: 118,
|
singleQuote: true,
|
||||||
semi: false,
|
tabWidth: 2,
|
||||||
singleQuote: true,
|
trailingComma: 'all',
|
||||||
tabWidth: 2,
|
// #endregion Prettier
|
||||||
trailingComma: 'all',
|
|
||||||
// #endregion Prettier
|
|
||||||
|
|
||||||
// #region @trivago/prettier-plugin-sort-imports
|
// #region @trivago/prettier-plugin-sort-imports
|
||||||
importOrder: ['^@', '^[./]']
|
importOrder: ['^@', '^[./]'],
|
||||||
// #endregion @trivago/prettier-plugin-sort-imports
|
// #endregion @trivago/prettier-plugin-sort-imports
|
||||||
};
|
}
|
||||||
|
|
||||||
export default prettierConfig;
|
export default prettierConfig
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: 'scratch-semantic-release-config',
|
extends: 'scratch-semantic-release-config',
|
||||||
branches: [
|
branches: [
|
||||||
{
|
{
|
||||||
name: 'master'
|
name: 'master',
|
||||||
// default channel
|
// default channel
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
};
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
|
||||||
|
|
||||||
"extends": [
|
extends: ['github>scratchfoundation/scratch-renovate-config:js-lib'],
|
||||||
"github>scratchfoundation/scratch-renovate-config:js-lib"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue