From 11d161649fea7845442d827d63368ff347da32e6 Mon Sep 17 00:00:00 2001 From: 1000ch Date: Sun, 21 Jul 2019 13:53:52 +0900 Subject: [PATCH 1/3] feat: add latex support --- lib/index.js | 4 +++- spec/fixtures/bad.latex | 5 +++++ spec/linter-textlint-spec.js | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/bad.latex diff --git a/lib/index.js b/lib/index.js index 4394412..360f330 100644 --- a/lib/index.js +++ b/lib/index.js @@ -43,7 +43,9 @@ export function provideLinter() { 'source.re', 'source.review', 'text.plain', - 'text.md' + 'text.md', + 'text.tex', + 'text.latex' ], scope: 'file', lintsOnChange: false, diff --git a/spec/fixtures/bad.latex b/spec/fixtures/bad.latex new file mode 100644 index 0000000..e9f46cf --- /dev/null +++ b/spec/fixtures/bad.latex @@ -0,0 +1,5 @@ +\documentclass{article} + +\begin{document} +HTML Import +\end{document} diff --git a/spec/linter-textlint-spec.js b/spec/linter-textlint-spec.js index 9beb9d2..0422c82 100644 --- a/spec/linter-textlint-spec.js +++ b/spec/linter-textlint-spec.js @@ -5,6 +5,7 @@ import * as path from 'path'; const good = path.join(__dirname, 'fixtures', 'good.md'); const markdown = path.join(__dirname, 'fixtures', 'bad.md'); const review = path.join(__dirname, 'fixtures', 'bad.re'); +const latex = path.join(__dirname, 'fixtures', 'bad.latex'); const textlintrcPath = path.join(__dirname, 'fixtures', '.textlintrc'); const textlintRulesDir = path.join(__dirname, '..', 'node_modules'); @@ -18,6 +19,7 @@ describe('The textlint provider for Linter', () => { const activation = Promise.all([ atom.packages.activatePackage('language-review'), + atom.packages.activatePackage('language-latex'), atom.packages.activatePackage('linter-textlint') ]); @@ -58,6 +60,16 @@ describe('The textlint provider for Linter', () => { }); }); + describe('checks bad.latex and', () => { + it('finds at least one message', () => { + waitsForPromise(() => atom.workspace.open(latex) + .then(editor => lint(editor)) + .then((messages) => { + expect(messages.length).toBeGreaterThan(0); + })); + }); + }); + describe('checks good.md and', () => { it('finds nothing wrong with a valid file', () => { waitsForPromise(() => atom.workspace.open(good) From 2b2845d92fe5686bb9b05382d42c08ccc976e7ae Mon Sep 17 00:00:00 2001 From: 1000ch Date: Sun, 21 Jul 2019 13:54:21 +0900 Subject: [PATCH 2/3] test: remove beta channel tests --- .circleci/config.yml | 2 +- .travis.yml | 5 +---- appveyor.yml | 3 +-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 989c614..45973e0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 defaults: &defaults environment: - APM_TEST_PACKAGES: "language-review" + APM_TEST_PACKAGES: "language-review language-latex" working_directory: /tmp/project docker: - image: arcanemagus/atom-docker-ci:stable diff --git a/.travis.yml b/.travis.yml index 0634881..575e48c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,14 +6,11 @@ matrix: - os: linux env: ATOM_CHANNEL=stable - - os: linux - env: ATOM_CHANNEL=beta - env: global: # Pre-install the required language file as package activation doesn't wait # for the installation to complete. - - APM_TEST_PACKAGES="language-review" + - APM_TEST_PACKAGES="language-review language-latex" ### Generic setup follows ### script: diff --git a/appveyor.yml b/appveyor.yml index 92ed3b9..dd1962b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,10 +1,9 @@ ### Project specific config ### environment: - APM_TEST_PACKAGES: language-review + APM_TEST_PACKAGES: language-review language-latex matrix: - ATOM_CHANNEL: stable - - ATOM_CHANNEL: beta ### Generic setup follows ### build_script: From b68d24253d6ad5554d5e4eeb78b6d2e6efea0fc5 Mon Sep 17 00:00:00 2001 From: 1000ch Date: Sun, 21 Jul 2019 17:21:59 +0900 Subject: [PATCH 3/3] chore: enable latex2e --- package-lock.json | 17 +++++++++++++++++ package.json | 1 + spec/fixtures/.textlintrc | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 7e0b2b3..ed461f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1705,6 +1705,12 @@ "error-ex": "^1.2.0" } }, + "parsimmon": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.12.1.tgz", + "integrity": "sha512-70VLg2g5CV8iBDYwxvREdR8qq56Y06K34+Dw8ENGvJWIsmOfs9ijB4IMPbYFVzOEhm2jRE/qTquq7GJ7tPnL7w==", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -2340,6 +2346,17 @@ "integrity": "sha1-JlXHLhVfPIQ5N8SorchzUhFr7r4=", "dev": true }, + "textlint-plugin-latex2e": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/textlint-plugin-latex2e/-/textlint-plugin-latex2e-0.2.2.tgz", + "integrity": "sha512-bLPKLzcOIPj9zbV71L1EM7+7KdYobMH9KhpMR9AqhIuu7UmF/wKQKrnqySdh04d8I9furcoI6yjBj4UPFgthjw==", + "dev": true, + "requires": { + "@textlint/ast-node-types": "^4.2.1", + "parsimmon": "^1.12.0", + "traverse": "^0.6.6" + } + }, "textlint-plugin-review": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/textlint-plugin-review/-/textlint-plugin-review-0.3.3.tgz", diff --git a/package.json b/package.json index 32dc0a2..882207f 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "eslint": "^6.1.0", "eslint-config-airbnb-base": "^13.2.0", "eslint-plugin-import": "^2.18.2", + "textlint-plugin-latex2e": "^0.2.2", "textlint-plugin-review": "^0.3.3" }, "package-deps": [ diff --git a/spec/fixtures/.textlintrc b/spec/fixtures/.textlintrc index 49cbd60..3e763df 100644 --- a/spec/fixtures/.textlintrc +++ b/spec/fixtures/.textlintrc @@ -3,6 +3,7 @@ "spellcheck-tech-word": true }, "plugins": [ - "review" + "review", + "latex2e" ] }