Skip to content

Commit

Permalink
add func-name-matching, phetsims/phet-info#156
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Oct 22, 2024
1 parent 6980e02 commit 22318c4
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 8 deletions.
7 changes: 7 additions & 0 deletions eslint/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ module.exports = {
// https://eslint.org/docs/rules/func-call-spacing
'func-call-spacing': [ 'error', 'never' ],

// requires function names to match the name of the variable or property to which they are assigned
// https://eslint.org/docs/rules/func-name-matching
'func-name-matching': [ 'error', 'always', {
includeCommonJSModuleExports: false,
considerPropertyDescriptor: true
} ],

// enforces spacing between keys and values in object literal properties
'key-spacing': [ 'error', { beforeColon: false, afterColon: true } ],

Expand Down
2 changes: 1 addition & 1 deletion eslint/rules/copyright.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function( context ) {

return {

Program: function checkCopyright( node ) {
Program: function( node ) {
// Get the whole source code, not for node only.
const comments = context.getSourceCode().getAllComments();

Expand Down
2 changes: 1 addition & 1 deletion eslint/rules/dispose.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = function( context ) {

return {

ExpressionStatement: function checkForDispose( node ) {
ExpressionStatement: function( node ) {

// look through the AST of a typical observer registration, see https://github.com/phetsims/chipper/issues/418
if ( node.expression &&
Expand Down
2 changes: 1 addition & 1 deletion eslint/rules/no-html-constructors.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ module.exports = function( context ) {
*
* @param {ASTNode} node
*/
'NewExpression:exit': function noHTMLConstructor( node ) {
'NewExpression:exit': function( node ) {

// Example...
//
Expand Down
2 changes: 1 addition & 1 deletion eslint/rules/no-property-in-require-statement.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function( context ) {

return {

VariableDeclaration: function noAttributesInRequireStatement( node ) {
VariableDeclaration: function( node ) {

if ( node.declarations &&
node.declarations.length > 0 &&
Expand Down
2 changes: 1 addition & 1 deletion eslint/rules/phet-io-require-contains-ifphetio.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function( context ) {

return {

VariableDeclaration: function phetioRequireContainsIfphetio( node ) {
VariableDeclaration: function( node ) {

// Here is the AST of a typical require statement node, for reference
// ( should be the same comment as in require-statement-match.js)
Expand Down
2 changes: 1 addition & 1 deletion eslint/rules/property-visibility-annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function( context ) {

return {

AssignmentExpression: function propertyVisibilityAnnotation( node ) {
AssignmentExpression: function( node ) {
let isAnnotated = false;

if ( node.left && node.left && node.left.object && node.left.object.type === 'ThisExpression' ) {
Expand Down
2 changes: 1 addition & 1 deletion eslint/rules/require-statement-match.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function( context ) {

return {

VariableDeclaration: function requireStatementMatch( node ) {
VariableDeclaration: function( node ) {

// Here is the AST of a typical require statement node, for reference
//var exemplar = {
Expand Down
2 changes: 1 addition & 1 deletion eslint/rules/todo-should-have-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if ( buildJSON && buildJSON.common && buildJSON.common.phetLibs ) {
module.exports = function( context ) {
return {

Program: function checkTodoShouldHaveIssue( node ) {
Program: function() {

// Check whether the given directory matches the whitelist
let directoryShouldBeChecked = false;
Expand Down

0 comments on commit 22318c4

Please sign in to comment.