Skip to content

Commit 654fbd9

Browse files
committed
Initial
0 parents  commit 654fbd9

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

Diff for: README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# eslint-plugin-exclude-php-tags
2+
3+
A preprocessor to remove PHP tags to prevent "Unexpected token <" errors in .phtml files.
4+
5+
## Under the hood
6+
7+
By fact it just replaces occurrences of `<?...?>` for `0` to prevent parsing of php code.
8+
9+
## Installation
10+
11+
You'll first need to install [ESLint](http://eslint.org):
12+
13+
```
14+
$ npm install eslint
15+
```
16+
17+
Next, install `eslint-plugin-exclude-php-tags`:
18+
19+
```
20+
$ npm install eslint-plugin-exclude-php-tags
21+
```
22+
23+
**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-exclude-php-tags` globally.
24+
25+
## Usage
26+
27+
Add `exclude-php-tags` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
28+
29+
```json
30+
{
31+
"plugins": [
32+
"exclude-php-tags"
33+
]
34+
}
35+
```

Diff for: lib/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
processors: {
3+
'.phtml': {
4+
preprocess: (text, filename) => [text.replace(/<\?.*\?>/g, '0')],
5+
postprocess: (messages, filename) => messages[0]
6+
}
7+
}
8+
}
9+

Diff for: package.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "eslint-plugin-exclude-php-tags",
3+
"version": "0.0.1",
4+
"description": "A preprocessor to remove PHP tags",
5+
"keywords": [
6+
"eslint",
7+
"eslintplugin",
8+
"eslint-plugin"
9+
],
10+
"author": {
11+
"name": "Alex",
12+
"email": "[email protected]"
13+
},
14+
"repository": {
15+
"type": "git",
16+
"url": "git+https://github.com/Alexnder/eslint-plugin-exclude-php-tags.git"
17+
},
18+
"main": "lib/index.js",
19+
"scripts": {
20+
"test": "echo \"Error: no test specified\" && exit 1"
21+
},
22+
"dependencies": { },
23+
"devDependencies": {
24+
"eslint": "^2.6.0",
25+
"mocha": "^2.4.5"
26+
},
27+
"engines": {
28+
"node": ">=6.0.0"
29+
},
30+
"license": "BSD-3-Clause"
31+
}

0 commit comments

Comments
 (0)