I have an AngularJs app which connects to a database using php PDO APIs.
This is the schematic data flow:
DB:
CREATE TABLE person (
...
first_name,
...
);
php API:
$stmt = $this->db->prepare("SELECT * FROM person");
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
var_dump($result);
...
'first_name' => 'Alice',
...
angular service:
getPerson: function (id) {
return $http({
method: 'GET',
url: apiUri + 'get' + '/' + id,
}).then(handleSuccess, handleError);
},
angular controller:
Person.getPerson(id).then(function(person) {
var name = person.first_name; // this throws a jslint warning
});
The problem is SQL recommended naming standard is underscore_case, while Angular's is camelCase...
I would not like to disable jslint, which is very useful, in other respects...
I know I could avoid warnings even with
{
"camelcase": false
}
in .jshintrc, but I'd prefer not to disable camelcase check globally...
Currently I avoid jslint warnings with "jslint comments", this way:
/* jshint camelcase: false */
var name = person.first_name;
/* jshint camelcase: true */
but my code is going to contain more jslint comments than code... Quite unreadable...
How do you (or would you) solve this issue?