Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9b48818

Browse files
Merge pull request #196 from WordPress/add/code-linting
Add: code linting scripts
2 parents c7fb87e + 885afb9 commit 9b48818

19 files changed

+29890
-30919
lines changed

‎.browserslistrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extends @wordpress/browserslist-config

‎.editorconfig‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
# WordPress Coding Standards
5+
# https://make.wordpress.org/core/handbook/coding-standards/
6+
7+
root = true
8+
9+
[*]
10+
charset = utf-8
11+
end_of_line = lf
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
indent_style = tab
15+
16+
[*.{yml,yaml}]
17+
indent_style = space
18+
indent_size = 2
19+
20+
[*.{gradle,java,kt}]
21+
indent_style = space
22+
23+
[packages/react-native-*/**.xml]
24+
indent_style = space
25+

‎.eslintignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
vendor
2+
node_modules
3+
build
4+
admin/js/lib

‎.eslintrc.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "plugin:@wordpress/eslint-plugin/recommended",
3+
"rules": {
4+
"no-undef": "off"
5+
}
6+
}

‎.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ wp-content/plugins/hello.php
1414
# ignore specific themes
1515
wp-content/themes/twenty*/
1616

17-
# ignore node dependency directories
17+
# ignore dependency directories
1818
node_modules/
19+
vendor/
1920

2021
# ignore log files and databases
2122
*.log

‎.husky/pre-commit‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "0ドル")/_/husky.sh"
3+
4+
npx lint-staged

‎.phpcs.xml.dist‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="plugins">
3+
<description>Apply WordPress Coding Standards to all files</description>
4+
5+
<!-- Only scan PHP files. -->
6+
<arg name="extensions" value="php"/>
7+
8+
<!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
9+
<arg name="cache"/>
10+
11+
<!-- Set the memory limit to 256M.
12+
For most standard PHP configurations, this means the memory limit will temporarily be raised.
13+
Ref: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#specifying-phpini-settings
14+
-->
15+
<ini name="memory_limit" value="256M"/>
16+
17+
<!-- Rule for checking the correct Text Domain. -->
18+
<rule ref="WordPress.WP.I18n">
19+
<properties>
20+
<property name="text_domain" type="array">
21+
<element value="twentytwentythree"/>
22+
<element value="default"/>
23+
</property>
24+
</properties>
25+
</rule>
26+
27+
<!-- Strip the filepaths down to the relevant bit. -->
28+
<arg name="basepath" value="./"/>
29+
30+
<!-- Check up to 20 files simultaneously. -->
31+
<arg name="parallel" value="20"/>
32+
33+
<!-- Show sniff codes in all reports. -->
34+
<arg value="ps"/>
35+
36+
<file>.</file>
37+
38+
<rule ref="WordPress-Core"/>
39+
<rule ref="WordPress.CodeAnalysis.EmptyStatement"/>
40+
41+
<!-- These rules are being set as warnings instead of errors, so we can error check the entire codebase. -->
42+
<rule ref="WordPress.PHP.YodaConditions.NotYoda">
43+
<type>warning</type>
44+
</rule>
45+
<rule ref="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase">
46+
<type>warning</type>
47+
</rule>
48+
<rule ref="WordPress.DB.PreparedSQL.InterpolatedNotPrepared">
49+
<type>warning</type>
50+
</rule>
51+
<rule ref="WordPress.DB.PreparedSQL.NotPrepared">
52+
<type>warning</type>
53+
</rule>
54+
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
55+
<type>warning</type>
56+
</rule>
57+
58+
<!-- Directories and third party library exclusions. -->
59+
<exclude-pattern>/vendor/*</exclude-pattern>
60+
<exclude-pattern>/node_modules/*</exclude-pattern>
61+
62+
<!-- Assignments in while conditions are a valid method of looping over iterables. -->
63+
<rule ref="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition">
64+
<exclude-pattern>*</exclude-pattern>
65+
</rule>
66+
67+
<!-- We're not going to rename files. -->
68+
<rule ref="WordPress.Files.FileName">
69+
<exclude-pattern>*</exclude-pattern>
70+
</rule>
71+
</ruleset>

‎.prettierignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build
2+
node_modules
3+
vendor

‎.prettierrc.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Import the default config file and expose it in the project root.
2+
// Useful for editor integrations.
3+
module.exports = require( '@wordpress/prettier-config' );

‎.stylelintignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build
2+
node_modules
3+
vendor

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /