Skip to content
Permalink
Browse files
Release candidate
* Lint the config using...itself 😱
* Add self-linting as test script
* Implement Cordova's four main ESLint configs

  - node
  - node-tests
  - browser
  - browser-tests

* Transform to scoped package
* Add coarse node engine restriction
* feat: commit package-lock.json
  • Loading branch information
raphinesse authored and erisu committed Nov 5, 2019
1 parent cbae969 commit 6972a0c61b14bce514225d60c463368f1683c422
Showing 13 changed files with 1,589 additions and 19 deletions.
@@ -0,0 +1,2 @@
root: true
extends: ./index.js
@@ -1,2 +1,51 @@
# eslint-config-cordova
Cordova ESLint Config
# @cordova/eslint-config
This repository centralizes the ESLint configuration used for Cordova's development.

## Installation

`eslint-config-cordova` comes with all plugins configs and even `eslint` itself. So all you need to do to get started is:

npm i -D @cordova/eslint-config


## Usage
```yml
# In package.json
{
"scripts": {
"eslint": "eslint ."
}
}
```

```yml
# In .eslintrc.yml
root: true
extends: '@cordova/eslint-config/node'
```

```yml
# In spec/.eslintrc.yml
extends: '@cordova/eslint-config/node-tests'
```

```yml
# In cordova-js-src/.eslintrc.yml
extends: '@cordova/eslint-config/browser'
```

## Reference

This package exposes the following shareable ESLint configurations:

### `@cordova/eslint-config/node` (or simply `@cordova`)
For linting scripts intended to be run with Node.js.

### `@cordova/eslint-config/node-tests`
For linting Jasmine tests of Cordova's Node.js scripts.

### `@cordova/eslint-config/browser`
For linting cordova-style CommonJS modules intended to be run in the browser (before they are bundled).

### `@cordova/eslint-config/browser-tests`
For linting Jasmine tests of Cordova's browser code.
@@ -0,0 +1,30 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

module.exports = {
extends: [
'./lib/base.js',
'./lib/browser.js',
'./lib/tests.js'
],

globals: {
cordova: false
}
};
@@ -0,0 +1,29 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

module.exports = {
extends: [
'./lib/base.js',
'./lib/browser.js'
],

env: {
commonjs: true
}
};
@@ -17,18 +17,4 @@
under the License.
*/

module.exports = {
globals: {
cordova: true
},

extends: ['semistandard'],

rules: {
indent: ['error', 4],
camelcase: 'off',
'padded-blocks': 'off',
'operator-linebreak': 'off',
'no-throw-literal': 'off'
}
};
module.exports = require('./node');
@@ -0,0 +1,36 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

module.exports = {
extends: 'semistandard',

env: {
// `semistandard` sets this to true. We reset it here,
// to make the config extend logic clearer.
node: false
},

rules: {
indent: ['error', 4],
camelcase: 'off',
'padded-blocks': 'off',
'operator-linebreak': 'off',
'no-throw-literal': 'off'
}
};
@@ -0,0 +1,24 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

module.exports = {
env: {
browser: true
}
};
@@ -0,0 +1,24 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

module.exports = {
env: {
node: true
}
};
@@ -0,0 +1,24 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

module.exports = {
env: {
jasmine: true
}
};
@@ -0,0 +1,26 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

module.exports = {
extends: [
'./lib/base.js',
'./lib/node.js',
'./lib/tests.js'
]
};
25 node.js
@@ -0,0 +1,25 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

module.exports = {
extends: [
'./lib/base.js',
'./lib/node.js'
]
};

0 comments on commit 6972a0c

Please sign in to comment.