You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the codebase I'm looking at, we have plenty of Twig code blocks using the {% twigcode %} with the Javascript code (if statements, includes of other files...), essentially dynamically generating some of the JavaScript content, and linting on those fails with the following error:
Parsing error: Unexpected token
e.g.
$('.select2').select2({'width':'100%'});
{% include('tools/toolsmodal.js.twig') %}
function submit(that, e, options) {
e.preventDefault();
Description
In the codebase I'm looking at, we have plenty of Twig code blocks using the {% twigcode %} with the Javascript code (if statements, includes of other files...), essentially dynamically generating some of the JavaScript content, and linting on those fails with the following error:
Parsing error: Unexpected token
e.g.
Suggestions on how to handle this setup?
Setup configuration
module.exports = {
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
},
extends: ['plugin:prettier/recommended', 'eslint:recommended', 'plugin:import/recommended', 'plugin:cypress/recommended'],
settings: {
'import/resolver': 'webpack',
},
plugins: ['babel', 'cypress', 'html'],
globals: {
global: true,
$: true,
trans: true,
enoriaLocale: true,
swal: true,
},
env: {
amd: true,
browser: true,
es6: true,
node: true,
},
ignorePatterns: ['**/js/views//.js'],
rules: {
'max-len': [
'error',
{
code: 250,
ignoreUrls: true,
ignoreComments: false,
ignoreRegExpLiterals: true,
ignoreStrings: false,
ignoreTemplateLiterals: false,
},
],
'no-console': 'error',
},
};
Aditional context
The text was updated successfully, but these errors were encountered: