Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV-37: Lint custom javascript with eslint #223

Merged
merged 20 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ae3e179
Exclude .js from php linters
jesconstantine Jun 7, 2023
efbfd0c
Install node dependencies and lint custom js in code-review target
jesconstantine Jun 7, 2023
0814481
Add config options for eslint directories and extensions
jesconstantine Jun 26, 2023
53cbedb
Use core's actual eslint dependency and our new eslint config options
jesconstantine Jun 26, 2023
a36cb40
Revert "Use core's actual eslint dependency and our new eslint config…
jesconstantine Jun 26, 2023
9da9153
Use built in tools for running eslint (node) and checking dependencie…
jesconstantine Jul 13, 2023
d44aeec
TEMP: update acquia memcache build install steps based on their docs
jesconstantine Jul 13, 2023
f7bf34a
Use yarn to execute eslint binary
jesconstantine Jul 13, 2023
5ed8b94
remove dependency on node dependencies from code-review task
jesconstantine Jul 13, 2023
42fbcb0
create discrete eslint phing task
jesconstantine Jul 13, 2023
1e5dd5d
use recommended yarn cli command for checking installed packages
jesconstantine Jul 13, 2023
f15aee8
Don't touch settings file which is being removed anyway
jesconstantine Jul 13, 2023
c1d7ef4
Clean up comments for the eslint target
jesconstantine Jul 13, 2023
0a5eec8
Make the directions clearer for multiple eslint directory patterns
jesconstantine Jul 13, 2023
946638a
Add more context for eslint ext argument.
jesconstantine Jul 13, 2023
5c3c004
I think we should allow ignore files, patterns to be used.
jesconstantine Jul 13, 2023
2aaded8
Merge branch 'develop' into dev-37-eslint
agentrickard Aug 16, 2023
893856d
dev-37 - Use php 8.1.18.
raylwalters Aug 16, 2023
042cee7
Revert "dev-37 - Use php 8.1.18."
raylwalters Aug 16, 2023
6bcfd92
Merge branch 'develop' into dev-37-eslint
byrond Aug 16, 2023
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
41 changes: 40 additions & 1 deletion defaults/install/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@


<!-- Target: code-review -->
<target name="code-review" description="Run the automated code reviews.">
<target name="code-review" description="Run the automated code reviews." depends="install-node-dependencies">
<!-- Run PHP's built in linter ('php -l') -->
<phplint deprecatedAsError="true" haltonfailure="true">
<fileset dir="${drupal.root}" includesfile="${phplint.includesfile}" />
Expand All @@ -127,6 +127,10 @@

<!-- Run Drupal Check. -->
<foreach list="${drupal-check.directories}" param="drupal-check.dir" target="drupal-check" />

<!-- Run eslint on custom javascript -->
<echo msg="$> npx eslint --ext .js ${drupal.root}/modules/custom" />
<exec command="npx eslint --ext .js --no-error-on-unmatched-pattern ${drupal.root}/modules/custom" logoutput="true" checkreturn="true" />
jesconstantine marked this conversation as resolved.
Show resolved Hide resolved
</target>


Expand All @@ -148,6 +152,41 @@
<exec command="vendor/bin/phpcbf" logoutput="true" checkreturn="false" />
</target>

<!-- Target: install-node-dependencies -->
<target name="install-node-dependencies" depends="" description="Install project, core, and custom module node dependencies">
<if>
<available property="check_dependencies_available" file="${drupal.root}/../node_modules/.bin/check-dependencies" />
<then>
<echo msg="Seeing if project npm packages are installed and at the expected version." />
<exec command="npx check-dependencies --verbose" returnProperty="project_dependencies" logoutput="true" />
<if>
<not>
<equals arg1="${project_dependencies}" arg2="0" />
</not>
<then>
<echo msg="Install project node dependencies to get eslint libraries." />
<exec dir="${drupal.root}/.." command="npm install" logoutput="true" />
</then>
</if>
</then>
<else>
<echo msg="Install project node dependencies to get eslint libraries." />
<exec dir="${drupal.root}/.." command="npm install" logoutput="true" />
</else>
</if>
<echo msg="Seeing if Drupal core npm packages are installed and at the expected version." />
<exec command="npx check-dependencies --verbose --packageDir ${drupal.root}/core" returnProperty="core_dependencies" logoutput="true" />
<if>
<not>
<equals arg1="${core_dependencies}" arg2="0" />
</not>
<then>
<echo msg="Install Core node dependencies to get eslint libraries." />
<exec dir="${drupal.root}/core" command="npm install" logoutput="true" checkreturn="true" />
</then>
</if>
</target>


<!-- Target: artifact -->
<target name="artifact" description="Build and deploy the application.">
Expand Down
2 changes: 1 addition & 1 deletion defaults/install/phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<config name="ignore_errors_on_exit" value="0" />

<!-- Set extensions to scan. -->
<arg name="extensions" value="php,module,inc,install,test,profile,theme,info,yml,css,js"/>
<arg name="extensions" value="php,module,inc,install,test,profile,theme,info,yml,css"/>

<!-- Use colors in output. -->
<arg name="colors"/>
Expand Down