Skip to content

Commit

Permalink
Merge pull request #2 from johnhooks/add-typescript-eslint
Browse files Browse the repository at this point in the history
build: add @typescript-eslint/plugin
  • Loading branch information
erikyo authored Feb 23, 2023
2 parents b9982ee + 72d6cef commit dfa3a43
Show file tree
Hide file tree
Showing 22 changed files with 23,838 additions and 23,103 deletions.
6 changes: 5 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

Expand All @@ -20,3 +20,7 @@ indent_style = tab

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
indent_style = space
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.cache
build
build-module
build-types
coverage
vendor
29 changes: 0 additions & 29 deletions .eslintrc.js

This file was deleted.

74 changes: 74 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": true,
"tsconfigRootDir": "."
},
"extends": [
"plugin:@wordpress/eslint-plugin/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/strict",
"plugin:import/recommended",
"plugin:import/typescript"
],
"plugins": [ "@typescript-eslint" ],
"rules": {
"import/order": [
"error",
{
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"newlines-between": "always",
"groups": [
"builtin",
"external",
"parent",
"sibling",
"index"
],
"pathGroups": [
{
"pattern": "@wordpress/**",
"group": "external"
}
],
"pathGroupsExcludedImportTypes": [ "builtin" ]
}
]
},
"overrides": [
{
"files": "tests/**/*",
"rules": {
"@typescript-eslint/no-unsafe-call": "off"
}
},
{
"files": "**/*.js",
"rules": {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off"
}
}
],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [ ".ts", ".tsx" ]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"project": [ "./" ]
}
}
},
"env": {
"browser": true,
"es2017": true,
"node": true
}
}
7 changes: 3 additions & 4 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ name: Node.js CI

on:
push:
branches: [ "master" ]
branches: ["master"]
pull_request:
branches: [ "master" ]
branches: ["master"]

jobs:
build:

runs-on: ubuntu-latest

strategy:
Expand All @@ -25,7 +24,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache: "npm"
- run: npm install
- run: npm run build --if-present

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

# The build directories
build/
build-types/

# Coverage directory used by tools like istanbul
coverage
artifacts
Expand Down
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.cache
build
build-module
build-types
coverage
vendor

**/*.md
18 changes: 18 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Import the default config file and expose it in the project root.
// Useful for editor integrations.
const prettierConfig = require( '@wordpress/prettier-config' );

module.exports = {
...prettierConfig,
proseWrap: 'never',
endOfLine: 'lf',
overrides: [
{
files: '*.{yml,yaml}',
options: {
singleQuote: false,
tabWidth: 2,
},
},
],
};
3 changes: 3 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
build-style
node_modules
25 changes: 25 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": "@wordpress/stylelint-config/scss",
"rules": {
"at-rule-empty-line-before": null,
"at-rule-no-unknown": null,
"comment-empty-line-before": null,
"font-weight-notation": null,
"max-line-length": null,
"no-descending-specificity": null,
"rule-empty-line-before": null,
"selector-class-pattern": null,
"value-keyword-case": null,
"scss/operator-no-unspaced": null,
"scss/selector-no-redundant-nesting-selector": null,
"scss/at-import-partial-extension": null,
"scss/no-global-function-names": null,
"scss/comment-no-empty": null,
"scss/at-extend-no-missing-placeholder": null,
"scss/operator-no-newline-after": null,
"scss/at-if-closing-brace-newline-after": null,
"scss/at-else-empty-line-before": null,
"scss/at-if-closing-brace-space-after": null,
"no-invalid-position-at-import-rule": null
}
}
2 changes: 1 addition & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"core": "WordPress/WordPress",
"plugins": ["."]
"plugins": [ "." ]
}
6 changes: 3 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/** @type {import('@babel/core').ConfigFunction} */
/** @type {import("@babel/core").ConfigFunction} */
module.exports = ( api ) => {
api.cache( true );

return {
presets: [
'@babel/preset-typescript',
'@wordpress/babel-preset-default',
'@babel/preset-typescript',
'@wordpress/babel-preset-default',
],
};
};
21 changes: 9 additions & 12 deletions block.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"apiVersion": 2,
"name": "block/boilerplate",
"title": "boilerplate",
"description": "A wp-block boilerplate in typescript",
"keywords": [
"wp-block",
"boilerplate"
],
"category": "media",
"editorScript": "file:./build/boilerplate.js",
"editorStyle": "file:./build/boilerplate.css",
"style": "file:./build/style-boilerplate.css"
"apiVersion": 2,
"name": "block/boilerplate",
"title": "boilerplate",
"description": "A wp-block boilerplate in typescript",
"keywords": [ "wp-block", "boilerplate" ],
"category": "media",
"editorScript": "file:./build/boilerplate.js",
"editorStyle": "file:./build/boilerplate.css",
"style": "file:./build/style-boilerplate.css"
}
Loading

0 comments on commit dfa3a43

Please sign in to comment.